Skip to content

Commit 0f55f89

Browse files
Ilia Sergachevgregkh
authored andcommitted
serial: liteuart: Fix NULL pointer dereference in ->remove()
drvdata has to be set in _probe() - otherwise platform_get_drvdata() causes null pointer dereference BUG in _remove(). Fixes: 1da81e5 ("drivers/tty/serial: add LiteUART driver") Cc: stable <[email protected]> Reviewed-by: Johan Hovold <[email protected]> Signed-off-by: Ilia Sergachev <[email protected]> Link: https://lore.kernel.org/r/20211115224944.23f8c12b@dtkw Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3dfac26 commit 0f55f89

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/tty/serial/liteuart.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ static int liteuart_probe(struct platform_device *pdev)
285285
port->line = dev_id;
286286
spin_lock_init(&port->lock);
287287

288+
platform_set_drvdata(pdev, port);
289+
288290
return uart_add_one_port(&liteuart_driver, &uart->port);
289291
}
290292

0 commit comments

Comments
 (0)