From nobody Fri Oct 2 13:03:22 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECBC73AAF64; Fri, 31 Jul 2026 07:56:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785484608; cv=none; b=s9UjxWyWerGjDCDnPnT2TYhER8x0PPjCWq2M02sBWu9kJSKg5/XvAFB2oqYYiM0DPWR96Gsy8+gBYH90jy3VnhyWqzuLmG5VGQeuI4xRJX88iwdrKME8rFP3U74bFsRAi4JssCHW/vL/BoP0kV5CpBk+A2Bg/oTRVfiaML8K15I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785484608; c=relaxed/simple; bh=vuu4yi+Ch+4YBtvqdb0qaT+V3buKa9JSxUmYrc3SimQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g0FM7dL9nLp67jHOWpq88f8OozbKNPCQXnmT2vwN+EixRnSp31nLBs9oncTzjpzJjTWTT3CwR3jeSb/rDImmCnp5M/vr7B2ITZ0lQcTr6ZgERt4W8/abhXzeQnuuW7OTMeW4Ayh2FWygC9x4ohyZMWpuTOEYzpFnZctmuvbSXPA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=e8x1QPbL; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="e8x1QPbL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30DB21F000E9; Fri, 31 Jul 2026 07:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785484606; bh=P+0f3FRwGuc3iVlmRv9G6z9YCsWFSVFsIX1I41Peutg=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=e8x1QPbLzWEsSmZTL7HNWViJzFi7JE93a+cRZgNAZZN9ZF7TuWXq/KDxnLfVoSZ8C uFgirH/8oozEv581TYkP2X3Zr1BPOQOWSXnfwX3crX1xOmOxG2YNTl49eMdKPcN0ky nF1efwBan4qXA6G1qJFEOIxvT/rB4ODoPUkPxRQo= From: Greg Kroah-Hartman Date: Fri, 31 Jul 2026 09:56:16 +0200 Subject: [PATCH 1/2] vt: stabilize tty reference in kbd_keycode with tty_port_tty_get Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260731-tty-vt-stuff-v1-1-be99b9da8e30@linuxfoundation.org> References: <20260731-tty-vt-stuff-v1-0-be99b9da8e30@linuxfoundation.org> In-Reply-To: <20260731-tty-vt-stuff-v1-0-be99b9da8e30@linuxfoundation.org> To: Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Joshua Rogers , Greg Kroah-Hartman , stable X-Mailer: b4 0.16-dev-401aa X-Developer-Signature: v=1; a=openpgp-sha256; l=1519; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=2Y4dwKFZsFE0B6a6UuQTZ9/hGIojB3XdtZDmwBQxBmY=; b=owGbwMvMwCRo6H6F97bub03G02pJDFk5oTplp7I9oth/WivVpl2bZi/gGR+7IWTTFPdXTZGJh 4T3xy/uiGVhEGRikBVTZPmyjefo/opDil6Gtqdh5rAygQxh4OIUgIkcsWVYsC57bayMSz9D1P6T gdfqilZtTskKZZgft2bp74d3kzS0K56nXHXdfldeZJsdAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 From: Joshua Rogers kbd_keycode() reads vc->port.tty without acquiring a tty reference, racing against con_shutdown() which clears port.tty under a different lock. Use tty_port_tty_get()/tty_kref_put() to hold a proper reference for the duration the tty pointer is needed. Assisted-by: AISLE:Snapshot Signed-off-by: Joshua Rogers Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/tty/vt/keyboard.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c index 763a3f1b7be0..c41d850b29c6 100644 --- a/drivers/tty/vt/keyboard.c +++ b/drivers/tty/vt/keyboard.c @@ -1437,7 +1437,7 @@ static void kbd_keycode(unsigned int keycode, int dow= n, bool hw_raw) struct keyboard_notifier_param param =3D { .vc =3D vc, .value =3D keycode= , .down =3D down }; int rc; =20 - tty =3D vc->port.tty; + tty =3D tty_port_tty_get(&vc->port); =20 if (tty && (!tty->driver_data)) { /* No driver data? Strange. Okay we fix it then. */ @@ -1497,9 +1497,12 @@ static void kbd_keycode(unsigned int keycode, int do= wn, bool hw_raw) * characters get aren't echoed locally. This makes key repeat * usable with slow applications and under heavy loads. */ + tty_kref_put(tty); return; } =20 + tty_kref_put(tty); + param.shift =3D shift_final =3D (shift_state | kbd->slockstate) ^ kbd->lo= ckstate; param.ledstate =3D kbd->ledflagstate; key_map =3D key_maps[shift_final]; --=20 2.55.0 From nobody Fri Oct 2 13:03:22 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDC663A5421; Fri, 31 Jul 2026 07:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785484611; cv=none; b=QKte0e+GhCkbckKMmYkmsogG4cGt7Mrkfn5YHfEM6fuqnRilgBLNe+Yza/cUgcdyisjSbLmvIF4+MSndOuolVQHOLrjU8lI/Q0NhWN7WgzJZM5IJcsadEZi0KtXUhOI5vI0a/0pQ0kl9RLecE3QWD64JaRWy5YRX6yuaMgaKcRI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785484611; c=relaxed/simple; bh=8gIvihe41YUE0hiTzXnY5GJgj3ZBN7qyQZyyUmoGS3w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gPMvrIjgx7BDM3nwbaccm4A4FjIDPPOG9kqO/hXGehB/axYJf+uKIp1d40qzFwR+qGq2zHXn7OcjoTA1ywD+T2DsH4B3BNrW36vlGh/hfCApqj/2ofvZJpQli1Lnd3bl5/gTCBhj0gP/RzzzTcNJ8gmNQO6M8F1Z7Pm6NJFpnqw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=AYEnP5uw; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="AYEnP5uw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0ACC81F000E9; Fri, 31 Jul 2026 07:56:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785484609; bh=Kc9FqxbwrDQZK5e9QJ3az4+a4TuBGMtiqHumcepk2ik=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=AYEnP5uwaZ9kuCkBUtebdPM9ue5ZanQRLCGPGoGPCugcDyte+InLAjYLr3Hu+L3BS cCJ/aJ1IQuCu602eGGXouTkIC5VypyXGxRb5dR3oAyIVxK97NrSfWnEIyi8kTtR05U dY6KsNah2ZUVTr2zLTFGtiuuWciVbAjws3/PANhU= From: Greg Kroah-Hartman Date: Fri, 31 Jul 2026 09:56:17 +0200 Subject: [PATCH 2/2] vt: add permission check for KDSKBMETA ioctl Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260731-tty-vt-stuff-v1-2-be99b9da8e30@linuxfoundation.org> References: <20260731-tty-vt-stuff-v1-0-be99b9da8e30@linuxfoundation.org> In-Reply-To: <20260731-tty-vt-stuff-v1-0-be99b9da8e30@linuxfoundation.org> To: Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Joshua Rogers , Greg Kroah-Hartman , stable X-Mailer: b4 0.16-dev-401aa X-Developer-Signature: v=1; a=openpgp-sha256; l=998; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=JrfJuRb/KjUHq199pdX8TWAXMXIH6h0YrvGkU30i36Q=; b=owGbwMvMwCRo6H6F97bub03G02pJDFk5obrHP1fULMjLNmMs4b/h7NNac9Z0YZd04q0rUXx98 7X2n9vfEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABPZeJphwZF9d1x/lrzft1zj seGKy2t4L5yp0GSYKyRn3rQtjItXOuzmI/5Im5YL89/MBAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 From: Joshua Rogers KDSKBMETA modifies keyboard meta mode but lacks the !perm check that all other keyboard setter ioctls in vt_k_ioctl() enforce, allowing a process to change meta mode on a non-controlling console without authorization. Assisted-by: AISLE:Snapshot Cc: stable Signed-off-by: Joshua Rogers Signed-off-by: Greg Kroah-Hartman --- drivers/tty/vt/vt_ioctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c index 28993a3d0acb..deb3b3f93461 100644 --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c @@ -406,6 +406,8 @@ static int vt_k_ioctl(struct tty_struct *tty, unsigned = int cmd, /* this could be folded into KDSKBMODE, but for compatibility reasons it is not so easy to fold KDGKBMETA into KDGKBMODE */ case KDSKBMETA: + if (!perm) + return -EPERM; return vt_do_kdskbmeta(console, arg); =20 case KDGKBMETA: --=20 2.55.0