Skip to content

Commit

Permalink
serial: uartlite: fix null dereference on probe error path
Browse files Browse the repository at this point in the history
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 <alexandru.ardelean@analog.com>
  • Loading branch information
commodo committed Mar 28, 2019
1 parent 17529e9 commit 1f47ad4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/tty/serial/uartlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1f47ad4

Please sign in to comment.