]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
vt: stabilize tty reference in kbd_keycode with tty_port_tty_get
authorJoshua Rogers <linux@joshua.hu>
Fri, 31 Jul 2026 07:56:16 +0000 (09:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 3 Aug 2026 14:31:12 +0000 (16:31 +0200)
commite25d47a526939ad44b75f778b8a7500562b84fc1
treed732f868cb99d3f1b4b1d6403b798fe8c03b2678
parent1423415471274abda87024967d7fe2206ceee0ea
vt: stabilize tty reference in kbd_keycode with tty_port_tty_get

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 <linux@joshua.hu>
Cc: stable <stable@kernel.org>
Link: https://patch.msgid.link/20260731-tty-vt-stuff-v1-1-be99b9da8e30@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/vt/keyboard.c