Skip to content

Commit

Permalink
[PATCH] tty_io.c balance tty_ldisc_ref()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Linus Torvalds committed Dec 13, 2006
1 parent a2db8df commit b3f13de
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions drivers/char/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b3f13de

Please sign in to comment.