* [PATCH v3] serial: liteuart: Fix NULL pointer dereference in ->remove()
@ 2021-11-15 21:49 Ilia Sergachev
0 siblings, 0 replies; only message in thread
From: Ilia Sergachev @ 2021-11-15 21:49 UTC (permalink / raw)
To: linux-serial
Cc: Karol Gugala, Mateusz Holenko, Jiri Slaby, Greg Kroah-Hartman,
Ilia Sergachev, Johan Hovold
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")
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Ilia Sergachev <silia@ethz.ch>
---
v2 -> v3: update subject and description
v1 -> v2: add Fixes:
drivers/tty/serial/liteuart.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c
index dbc0559a9157..f075f4ff5fcf 100644
--- a/drivers/tty/serial/liteuart.c
+++ b/drivers/tty/serial/liteuart.c
@@ -285,6 +285,8 @@ static int liteuart_probe(struct platform_device *pdev)
port->line = dev_id;
spin_lock_init(&port->lock);
+ platform_set_drvdata(pdev, port);
+
return uart_add_one_port(&liteuart_driver, &uart->port);
}
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-15 22:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-15 21:49 [PATCH v3] serial: liteuart: Fix NULL pointer dereference in ->remove() Ilia Sergachev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).