Thread (215 messages) flat view 215 messages, 8 authors, 2021-12-07
STALE1740d REVIEWED: 3 (3M)

1 review trailer.

[PATCH 5.15 204/207] serial: liteuart: Fix NULL pointer dereference in ->remove()

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2021-12-06 15:46:18
Also in: lkml

From: Ilia Sergachev <redacted>

commit 0f55f89d98c8b3e12b4f55f71c127a173e29557c upstream.

drvdata has to be set in _probe() - otherwise platform_get_drvdata()
causes null pointer dereference BUG in _remove().

Fixes: 1da81e5562fa ("drivers/tty/serial: add LiteUART driver")
Cc: stable <redacted>
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Ilia Sergachev <redacted>
Link: https://lore.kernel.org/r/20211115224944.23f8c12b@dtkw (local)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/tty/serial/liteuart.c |    2 ++
 1 file changed, 2 insertions(+)
--- a/drivers/tty/serial/liteuart.c
+++ b/drivers/tty/serial/liteuart.c
@@ -285,6 +285,8 @@ static int liteuart_probe(struct platfor
 	port->line = dev_id;
 	spin_lock_init(&port->lock);
 
+	platform_set_drvdata(pdev, port);
+
 	return uart_add_one_port(&liteuart_driver, &uart->port);
 }
 

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help