uml: DEBUG_SHIRQ fixes
authorJeff Dike <jdike@addtoit.com>
Tue, 5 Feb 2008 06:31:19 +0000 (22:31 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 5 Feb 2008 17:44:31 +0000 (09:44 -0800)
A couple more DEBUG_SHIRQ fixes.

The previous mconsole blocking fix exposed the lack of O_NONBLOCK on the
mconsole socket.

Also, winch_interrupt started crashing because it is called at irq free time
and it tries to dereference tty->driver_data, which has already been set to
NULL.

I added some error cleanup in mconsole_init while I was there.

Cc: "Karol Swietlicki" <magotari@gmail.com>
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/um/drivers/line.c
arch/um/drivers/mconsole_kern.c

index fac058b49282924e641c298954001eb648c682aa..2c898c4d6b6ae6b7864199e73ae2ec32db84f243 100644 (file)
@@ -774,9 +774,11 @@ static irqreturn_t winch_interrupt(int irq, void *data)
        tty = winch->tty;
        if (tty != NULL) {
                line = tty->driver_data;
-               chan_window_size(&line->chan_list, &tty->winsize.ws_row,
-                                &tty->winsize.ws_col);
-               kill_pgrp(tty->pgrp, SIGWINCH, 1);
+               if (line != NULL) {
+                       chan_window_size(&line->chan_list, &tty->winsize.ws_row,
+                                        &tty->winsize.ws_col);
+                       kill_pgrp(tty->pgrp, SIGWINCH, 1);
+               }
        }
  out:
        if (winch->fd != -1)
index fabd75f5bb5c06bf4a54723720226a4a5b38847c..c953e1477be4144efe727b7dfd4e34b90be89f38 100644 (file)
@@ -792,6 +792,8 @@ static int __init mconsole_init(void)
                printk(KERN_ERR "Failed to initialize management console\n");
                return 1;
        }
+       if (os_set_fd_block(sock, 0))
+               goto out;
 
        register_reboot_notifier(&reboot_notifier);
 
@@ -800,7 +802,7 @@ static int __init mconsole_init(void)
                             "mconsole", (void *)sock);
        if (err) {
                printk(KERN_ERR "Failed to get IRQ for management console\n");
-               return 1;
+               goto out;
        }
 
        if (notify_socket != NULL) {
@@ -816,6 +818,10 @@ static int __init mconsole_init(void)
        printk(KERN_INFO "mconsole (version %d) initialized on %s\n",
               MCONSOLE_VERSION, mconsole_socket_name);
        return 0;
+
+ out:
+       os_close_file(sock);
+       return 1;
 }
 
 __initcall(mconsole_init);