Skip to content

Commit a553add

Browse files
rddunlapgregkh
authored andcommitted
serial: uartlite: fix exit path null pointer
Call uart_unregister_driver() conditionally instead of unconditionally, only if it has been previously registered. This uses driver.state, just as the sh-sci.c driver does. Fixes this null pointer dereference in tty_unregister_driver(), since the 'driver' argument is null: general protection fault: 0000 [#1] PREEMPT SMP KASAN PTI RIP: 0010:tty_unregister_driver+0x25/0x1d0 Fixes: 238b872 ("[PATCH] serial uartlite driver") Signed-off-by: Randy Dunlap <[email protected]> Cc: stable <[email protected]> Cc: Peter Korsgaard <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9050079 commit a553add

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/tty/serial/uartlite.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,8 @@ static int __init ulite_init(void)
897897
static void __exit ulite_exit(void)
898898
{
899899
platform_driver_unregister(&ulite_platform_driver);
900-
uart_unregister_driver(&ulite_uart_driver);
900+
if (ulite_uart_driver.state)
901+
uart_unregister_driver(&ulite_uart_driver);
901902
}
902903

903904
module_init(ulite_init);

0 commit comments

Comments
 (0)