[PATCH] Char: mxser, fix oops when removing opened
authorJiri Slaby <jirislaby@gmail.com>
Sat, 30 Dec 2006 00:47:34 +0000 (16:47 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Sat, 30 Dec 2006 18:55:55 +0000 (10:55 -0800)
tty_driver->owner is not set, so if somebody remove mxser_module, it might
oops (and doesn't tell the user: no way, it's in use). Set the .owner value.

Cc: <osv@javad.com>
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/char/mxser.c
drivers/char/mxser_new.c

index c063359baf78ea1f2f020124e4b5f18e598e9db0..83f604b19290706f3a04577c463a4cfeec029a0a 100644 (file)
@@ -717,6 +717,7 @@ static int mxser_init(void)
 
        /* Initialize the tty_driver structure */
        memset(mxvar_sdriver, 0, sizeof(struct tty_driver));
+       mxvar_sdriver->owner = THIS_MODULE;
        mxvar_sdriver->magic = TTY_DRIVER_MAGIC;
        mxvar_sdriver->name = "ttyMI";
        mxvar_sdriver->major = ttymajor;
index cd989dce7c5387891ba8685fae2503fd62d0e78e..1bb030b3a51a6ec3017cf2d21537ceef4f6f1fbf 100644 (file)
@@ -2690,6 +2690,7 @@ static int __init mxser_module_init(void)
                MXSER_VERSION);
 
        /* Initialize the tty_driver structure */
+       mxvar_sdriver->owner = THIS_MODULE;
        mxvar_sdriver->magic = TTY_DRIVER_MAGIC;
        mxvar_sdriver->name = "ttyMI";
        mxvar_sdriver->major = ttymajor;