Skip to content

serial: 8250_dw: fix port leak on clock notifier failure

Denis Arefev linux-serial lkml stable 1 version Applied

Status from this message: Queued for 5.10, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2serial: 8250_dw: Use dev_err_probe()drivers/tty/serial/8250/8250_dw.c+11 -170 replies
2/2serial: 8250_dw: unregister 8250 port if clk_notifier_register() failsdrivers/tty/serial/8250/8250_dw.c+3 -10 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchAndy Shevchenko
1/2
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2 5.10] serial: 8250_dw: fix port leak on clock notifier failure

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(-)
Signature · 1 line
2.43.0