Skip to content

Commit

Permalink
serial: liteuart: Fix NULL pointer dereference in ->remove()
Browse files Browse the repository at this point in the history
commit 0f55f89 upstream.

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>
  • Loading branch information
Ilia Sergachev authored and gregkh committed Dec 8, 2021
1 parent 54b4cfe commit 189c99c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/tty/serial/liteuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 189c99c

Please sign in to comment.