milos-linux/drivers/tty
Stepan Ionichev 778b9dda4b serial: 8250_dw: unregister 8250 port if clk_notifier_register() fails
commit 10fc708b4de7f86002d2d735a2dbf3b5b7f65692 upstream.

dw8250_probe() registers the 8250 port via serial8250_register_8250_port()
and then, if the device has a clock, registers a clock notifier. If
clk_notifier_register() fails, probe returns the error but leaves the
8250 port registered. The matching serial8250_unregister_port() lives
in dw8250_remove(), which is not called when probe fails, so the port
slot stays occupied until the device is rebound or the system is
rebooted. The devm-allocated driver data is freed while the port still
references it (via the saved private_data and serial_in/serial_out
callbacks), so any access to that port slot before a rebind is a
use-after-free hazard.

Unregister the port on the clk_notifier_register() error path.

Fixes: cc816969d7 ("serial: 8250_dw: Fix common clocks usage race condition")
Cc: stable@vger.kernel.org
Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20260514143746.23671-2-sozdayvek@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-06-27 11:08:17 +01:00
..
hvc hvc/xen: Check console connection flag 2026-04-10 11:06:17 +02:00
ipwireless Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
serdev serdev: Do not return -ENODEV from of_serdev_register_devices() if external connector is used 2026-03-31 09:48:43 +02:00
serial serial: 8250_dw: unregister 8250 port if clk_notifier_register() fails 2026-06-27 11:08:17 +01:00
vt vc_screen: fix null-ptr-deref in vcs_notifier() during concurrent vcs_write 2026-06-27 11:08:17 +01:00
amiserial.c tty: amiserial: Fix namespace collision and startup() section placement with -ffunction-sections 2025-11-21 10:04:09 +01:00
ehv_bytechan.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
goldfish.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
Kconfig TTY/Serial driver updates for 6.15-rc1 2025-04-02 18:17:33 -07:00
Makefile
mips_ejtag_fdc.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
moxa.c tty: moxa: use guard()s 2025-11-21 18:30:40 +01:00
mxser.c mxser: use guard()s 2025-08-17 12:46:26 +02:00
n_gsm.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
n_hdlc.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
n_null.c
n_tty.c tty: n_tty: use guard()s 2025-11-21 18:30:40 +01:00
nozomi.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
pty.c tty: tty_port: add workqueue to flip TTY buffer 2026-03-12 15:26:29 +01:00
rpmsg_tty.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
synclink_gt.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sysrq.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
tty.h
tty_audit.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
tty_baudrate.c
tty_buffer.c tty: tty_port: add workqueue to flip TTY buffer 2026-03-12 15:26:29 +01:00
tty_io.c tty: tty_port: add workqueue to flip TTY buffer 2026-03-12 15:26:29 +01:00
tty_ioctl.c tty: simplify throttling using guard()s 2025-04-25 13:46:30 +02:00
tty_jobctrl.c
tty_ldisc.c tty: constify tty_ldisc_ops 2026-03-12 15:05:34 +01:00
tty_ldsem.c tty/ldsem: Remove unused ldsem_down_write_trylock 2025-02-04 14:38:42 +01:00
tty_mutex.c
tty_port.c tty: tty_port: add workqueue to flip TTY buffer 2026-03-12 15:26:29 +01:00
ttynull.c tty: add missing MODULE_DESCRIPTION() macros 2024-06-24 16:10:11 +02:00
vcc.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00