[PATCH 1/2] tty: serial: ip22zilog: Fix potential NULL dereference on exit
From: Guangshuo Li
Date: Mon Nov 02 2026 - 19:46:19 EST
uart_unregister_driver() frees and clears the shared UART state before
platform driver removal calls uart_remove_one_port(), which still needs
that state.
Remove the ports before unregistering the UART driver.
This issue was found by our static analysis tool under development.
Fixes: 3fc36ae6abd2 ("tty: serial: ip22zilog: Use platform device for probing")
Signed-off-by: Guangshuo Li <liguangshuo@xxxxxxxxxxxxxxx>
---
Build-tested the affected object with MIPS ip22_defconfig and LLVM
(W=1). No hardware or fault-injection testing was performed.
drivers/tty/serial/ip22zilog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/ip22zilog.c b/drivers/tty/serial/ip22zilog.c
index 3fb8fdf8a853..b2a9c9652924 100644
--- a/drivers/tty/serial/ip22zilog.c
+++ b/drivers/tty/serial/ip22zilog.c
@@ -1140,8 +1140,8 @@ static int __init ip22zilog_init(void)
static void __exit ip22zilog_exit(void)
{
- uart_unregister_driver(&ip22zilog_reg);
platform_driver_unregister(&ip22zilog_driver);
+ uart_unregister_driver(&ip22zilog_reg);
}
module_init(ip22zilog_init);
--
2.43.0