public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] tty_io.c balance tty_ldisc_ref()
@ 2006-12-10 20:56 dcarpenter
  2006-12-10 21:26 ` Alan
  0 siblings, 1 reply; 2+ messages in thread
From: dcarpenter @ 2006-12-10 20:56 UTC (permalink / raw)
  To: linux-kernel

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>

diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 4044c86..bf6699b 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -3335,18 +3335,13 @@ #else
 	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);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] tty_io.c balance tty_ldisc_ref()
  2006-12-10 20:56 [patch] tty_io.c balance tty_ldisc_ref() dcarpenter
@ 2006-12-10 21:26 ` Alan
  0 siblings, 0 replies; 2+ messages in thread
From: Alan @ 2006-12-10 21:26 UTC (permalink / raw)
  To: dcarpenter; +Cc: linux-kernel, akpm

On Sun, 10 Dec 2006 12:56:55 -0800
dcarpenter <error27@gmail.com> wrote:

> 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.

Well spotted and nicely fixed.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Acked-by: Alan Cox <alan@redhat.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-12-10 21:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-10 20:56 [patch] tty_io.c balance tty_ldisc_ref() dcarpenter
2006-12-10 21:26 ` Alan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox