]> git.hungrycats.org Git - linux/commitdiff
[PATCH] con_close() deadlock fix
authorAndrew Morton <akpm@osdl.org>
Thu, 25 Mar 2004 02:13:09 +0000 (18:13 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 25 Mar 2004 02:13:09 +0000 (18:13 -0800)
I'd assumed that vcs_remove_devfs() could not possibly take console_sem().
Seems I was wrong.

drivers/char/vt.c

index 2b3965c06999d5c0f85dd218e87d945e4d56babf..7cb653b8422727c08bf5a53eeda42915f7e9e628 100644 (file)
@@ -2487,11 +2487,13 @@ static void con_close(struct tty_struct *tty, struct file *filp)
        if (tty && tty->count == 1) {
                struct vt_struct *vt;
 
-               vcs_remove_devfs(tty);
                vt = tty->driver_data;
                if (vt)
                        vc_cons[vt->vc_num].d->vc_tty = NULL;
                tty->driver_data = 0;
+               release_console_sem();
+               vcs_remove_devfs(tty);
+               return;
        }
        release_console_sem();
 }