Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH 0/2 5.10] serial: 8250_dw: fix port leak on clock notifier failure
@ 2026-09-08  9:36 Denis Arefev
  2026-09-08  9:36 ` [PATCH 1/2 5.10] serial: 8250_dw: Use dev_err_probe() Denis Arefev
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Denis Arefev @ 2026-09-08  9:36 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman
  Cc: Andy Shevchenko, Jiri Slaby, Sasha Levin, Artem Shimko,
	Stepan Ionichev, Serge Semin, linux-serial, linux-kernel

This series cleans up the error handling in dw8250_probe() and fixes a
port leak. When clk_notifier_register() fails, probe() returns an error
but the 8250 port registered just before it stays registered: the
matching serial8250_unregister_port() lives in dw8250_remove(), which is
not called on probe failure. The port slot then stays occupied until a
rebind, and the devm-allocated driver data is freed while the port still
references it (via private_data and the serial_in/serial_out callbacks),
a use-after-free hazard.

The first patch converts the probe() error paths to dev_err_probe().
The second patch unregisters the 8250 port on the
clk_notifier_register() error path.

Andy Shevchenko (1):
  serial: 8250_dw: Use dev_err_probe()

Stepan Ionichev (1):
  serial: 8250_dw: unregister 8250 port if clk_notifier_register() fails

 drivers/tty/serial/8250/8250_dw.c | 32 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 18 deletions(-)
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-08 22:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-08  9:36 [PATCH 0/2 5.10] serial: 8250_dw: fix port leak on clock notifier failure Denis Arefev
2026-09-08  9:36 ` [PATCH 1/2 5.10] serial: 8250_dw: Use dev_err_probe() Denis Arefev
2026-09-08  9:36 ` [PATCH 2/2 5.10] serial: 8250_dw: unregister 8250 port if clk_notifier_register() fails Denis Arefev
2026-09-08 22:39 ` [PATCH 0/2 5.10] serial: 8250_dw: fix port leak on clock notifier failure Sasha Levin
2026-09-08 22:59   ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox