From 1f47ad4dd96d520be19e8756a11b43e5234e0070 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Thu, 28 Mar 2019 14:08:04 +0200 Subject: [PATCH] serial: uartlite: fix null dereference on probe error path The `pdata->ulite_uart_driver` is assigned last in the probe function. So, when un-registering the serial device on the error path this causes a null dereference and a crash. This fixes that by passing the initialized `ulite_uart_driver` pointer. Signed-off-by: Alexandru Ardelean --- drivers/tty/serial/uartlite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c index fc567659e5eb03..9d18616c8c07b4 100644 --- a/drivers/tty/serial/uartlite.c +++ b/drivers/tty/serial/uartlite.c @@ -953,7 +953,7 @@ static int ulite_probe(struct platform_device *pdev) pm_runtime_set_suspended(&pdev->dev); pm_runtime_dont_use_autosuspend(&pdev->dev); err_out_unregister_driver: - uart_unregister_driver(pdata->ulite_uart_driver); + uart_unregister_driver(ulite_uart_driver); err_out_id: mutex_lock(&bitmap_lock); clear_bit(pdata->id, bitmap);