[PATCH] tty_io.c balance tty_ldisc_ref()
authorDan Carpenter <error27@gmail.com>
Wed, 13 Dec 2006 08:35:09 +0000 (00:35 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Wed, 13 Dec 2006 17:05:53 +0000 (09:05 -0800)
tty_ldisc_deref() should only be called when tty_ldisc_ref() succeeds
otherwise it triggers a BUG().  There's already a function
tty_ldisc_flush() that flushes properly.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/char/tty_io.c

index a928f6af52f247cf4eb405df3894fd76d3e78ad5..47a6eacb10bc4c0c49dc54357be1f7adf9e36fd7 100644 (file)
@@ -3335,18 +3335,13 @@ static void __do_SAK(struct work_struct *work)
        int session;
        int             i;
        struct file     *filp;
-       struct tty_ldisc *disc;
        struct fdtable *fdt;
        
        if (!tty)
                return;
        session = tty->session;
        
-       /* We don't want an ldisc switch during this */
-       disc = tty_ldisc_ref(tty);
-       if (disc && disc->flush_buffer)
-               disc->flush_buffer(tty);
-       tty_ldisc_deref(disc);
+       tty_ldisc_flush(tty);
 
        if (tty->driver->flush_buffer)
                tty->driver->flush_buffer(tty);