summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorIlia Sergachev <silia@ethz.ch>2021-11-16 00:49:44 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-12-08 11:04:57 +0300
commit189c99c629bbf85916c02c153f904649cc0a9d7f (patch)
treef24e32cc2ec7a70b8123da0264c323ef5f4e1161 /drivers/tty
parent54b4cfe4c99944751c614dbbd20dc86efa13ef7e (diff)
downloadlinux-189c99c629bbf85916c02c153f904649cc0a9d7f.tar.xz
serial: liteuart: Fix NULL pointer dereference in ->remove()
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 <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>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/liteuart.c2
1 files changed, 2 insertions, 0 deletions
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);
}