Commit 0f55f89d authored by Ilia Sergachev's avatar Ilia Sergachev Committed by Greg Kroah-Hartman

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: 1da81e55 ("drivers/tty/serial: add LiteUART driver")
Cc: stable <stable@vger.kernel.org>
Reviewed-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarIlia Sergachev <silia@ethz.ch>
Link: https://lore.kernel.org/r/20211115224944.23f8c12b@dtkwSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3dfac26e
...@@ -285,6 +285,8 @@ static int liteuart_probe(struct platform_device *pdev) ...@@ -285,6 +285,8 @@ static int liteuart_probe(struct platform_device *pdev)
port->line = dev_id; port->line = dev_id;
spin_lock_init(&port->lock); spin_lock_init(&port->lock);
platform_set_drvdata(pdev, port);
return uart_add_one_port(&liteuart_driver, &uart->port); return uart_add_one_port(&liteuart_driver, &uart->port);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment