From: Dan Carpenter Date: Wed, 13 Dec 2006 08:35:09 +0000 (-0800) Subject: [PATCH] tty_io.c balance tty_ldisc_ref() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b3f13debd593dbd7242a4ecf6c9b4d529805e5a0;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [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: Dan Carpenter Acked-by: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index a928f6af52f2..47a6eacb10bc 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -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);