提交 b3f13deb 编写于 作者: D Dan Carpenter 提交者: Linus Torvalds

[PATCH] tty_io.c balance tty_ldisc_ref()

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: NDan Carpenter <error27@gmail.com>
Acked-by: NAlan Cox <alan@redhat.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 a2db8dfc
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册