linux/drivers/staging
Johan Hovold 8df07fe935 tty: fix saved termios reset race
Resetting saved termios state on device registration is needed where a
minor number can be reused for an entirely different device and where
the old settings may prevent the port from even being opened (e.g. when
CLOCAL is not set).

Not all TTY drivers guarantee that the minor number is no longer in use
when registering devices however, something which can lead to a
use-after-free when closing a TTY (and saving its termios) races with
re-registration.

Add a new TTY_DRIVER_RESET_SAVED_TERMIOS flag to request that any saved
termios state is reset on registration and only set it for drivers that
make sure that the minor number is no longer in use.

Fixes: 93857edd98 ("tty: reset termios state on device registration")
Reported-by: Chengfeng Ye <nicoyip.dev@gmail.com>
Link: https://lore.kernel.org/20260926184154.3017929-1-nicoyip.dev@gmail.com
Cc: stable@kernel.org	# 4.12
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260930131845.1809256-1-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-10-01 11:05:17 +02:00
..
axis-fifo staging: axis-fifo: Remove unused includes 2026-07-28 09:25:02 +02:00
fbtft staging: fbtft: make dirty_lock IRQ-safe 2026-09-01 12:14:29 +02:00
greybus tty: fix saved termios reset race 2026-10-01 11:05:17 +02:00
iio staging: iio: adt7316: Remove redundant dev_err() 2026-07-24 01:14:07 +01:00
media treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
most staging: most: video: replace pr_err with dev_err 2026-07-28 09:23:33 +02:00
nvec staging: nvec: nvec_power: use GFP_KERNEL in probe() 2026-07-17 14:18:08 +02:00
octeon staging: octeon: handle rx/tx initialization failures in probe 2026-07-07 11:25:28 +02:00
rtl8723bs staging: rtl8723bs: fix OOB read in rtw_restruct_wmm_ie() 2026-09-01 12:15:16 +02:00
sm750fb staging: sm750fb: fix mono image source stride mismatch in lynxfb_ops_imageblit() 2026-09-01 15:51:53 +02:00
vc04_services Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
vme_user staging: vme_user: fix location monitor leak in tsi148 bridge 2026-07-07 13:41:56 +02:00
Kconfig staging: gpib: Destage gpib 2025-11-24 17:52:11 +01:00
Makefile staging: gpib: Destage gpib 2025-11-24 17:52:11 +01:00