Skip to contentSkip to conversation

fix oops in driver/serial/core.c

PATCH hugang 2 participants 2 messages Jun 8, 2003 – Jun 9, 2003

lore
Share & tools
lore

hugang

author
#0 lore raw

Hell all:

Fix bug in 2.5.70.

drivers/serial/core.c renamed from drivers/serial/core.c.old +1 -1
@@ -2189,11 +2189,11 @@
 void uart_unregister_driver(struct uart_driver *drv)
 {
 	struct tty_driver *p = drv->tty_driver;
-	drv->tty_driver = NULL;
 	tty_unregister_driver(p);
 	kfree(drv->state);
 	kfree(drv->tty_driver->termios);
 	kfree(drv->tty_driver);
+	drv->tty_driver = NULL;
 }
 
 struct tty_driver *uart_console_device(struct console *co, int *index)
Signature · 6 lines
Hu Gang / Steve
Email        : [email protected], [email protected]
GPG FinePrint: 4099 3F1D AE01 1817 68F7  D499 A6C2 C418 86C8 610E
http://soulinfo.com/~hugang/HuGang.asc
ICQ#         : 205800361
Registered Linux User : 204016
#1 lore raw

How about the following patch instead, which preserves the reordering done by Al Viro?

===== drivers/serial/core.c 1.62 vs edited =====

drivers/serial/core.c +2 -2
@@ -2192,8 +2192,8 @@
 	drv->tty_driver = NULL;
 	tty_unregister_driver(p);
 	kfree(drv->state);
-	kfree(drv->tty_driver->termios);
-	kfree(drv->tty_driver);
+	kfree(p->termios);
+	kfree(p);
 }
 
 struct tty_driver *uart_console_device(struct console *co, int *index)