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 <stable@vger.kernel.org> Reviewed-by: Johan Hovold <johan@kernel.org> Signed-off-by: Ilia Sergachev <silia@ethz.ch> Link: https://lore.kernel.org/r/20211115224944.23f8c12b@dtkw Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3dfac26 commit 0f55f89

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

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)