From 249da5c93729713e779203bb742d8f35d9f12a7d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 3 Aug 2006 13:45:09 -0700 Subject: [PATCH] add tty patch to queue --- queue-2.6.17/series | 1 + .../tty-serialize-flush_to_ldisc.patch | 63 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 queue-2.6.17/tty-serialize-flush_to_ldisc.patch diff --git a/queue-2.6.17/series b/queue-2.6.17/series index 0df4550dddb..ef401a4ad16 100644 --- a/queue-2.6.17/series +++ b/queue-2.6.17/series @@ -18,3 +18,4 @@ e1000-add-forgotten-pci-id-for-supported-device.patch cond_resched-fix.patch fix-budget-av-compile-failure.patch s390-fix-futex_atomic_cmpxchg_inatomic.patch +tty-serialize-flush_to_ldisc.patch diff --git a/queue-2.6.17/tty-serialize-flush_to_ldisc.patch b/queue-2.6.17/tty-serialize-flush_to_ldisc.patch new file mode 100644 index 00000000000..0be7e45b1b0 --- /dev/null +++ b/queue-2.6.17/tty-serialize-flush_to_ldisc.patch @@ -0,0 +1,63 @@ +From paulkf@microgate.com Wed Jul 26 12:11:54 2006 +Subject: tty serialize flush_to_ldisc +From: Paul Fulghum +To: Greg KH +Cc: Alan Cox , + Chuck Ebbert <76306.1226@compuserve.com>, + linux-stable +Date: Wed, 26 Jul 2006 14:10:29 -0500 +Message-Id: <1153941029.6903.5.camel@amdx2.microgate.com> + +From: Paul Fulghum + +Serialize processing of tty buffers in flush_to_ldisc +to fix (very rare) corruption of tty buffer free list +on SMP systems. + +Signed-off-by: Paul Fulghum +Acked-by: Alan Cox +Signed-off-by: Greg Kroah-Hartman + + +--- + drivers/char/tty_io.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +--- linux-2.6.17.7.orig/drivers/char/tty_io.c ++++ linux-2.6.17.7/drivers/char/tty_io.c +@@ -2776,7 +2776,7 @@ static void flush_to_ldisc(void *private + struct tty_struct *tty = (struct tty_struct *) private_; + unsigned long flags; + struct tty_ldisc *disc; +- struct tty_buffer *tbuf; ++ struct tty_buffer *tbuf, *head; + int count; + char *char_buf; + unsigned char *flag_buf; +@@ -2793,7 +2793,9 @@ static void flush_to_ldisc(void *private + goto out; + } + spin_lock_irqsave(&tty->buf.lock, flags); +- while((tbuf = tty->buf.head) != NULL) { ++ head = tty->buf.head; ++ tty->buf.head = NULL; ++ while((tbuf = head) != NULL) { + while ((count = tbuf->commit - tbuf->read) != 0) { + char_buf = tbuf->char_buf_ptr + tbuf->read; + flag_buf = tbuf->flag_buf_ptr + tbuf->read; +@@ -2802,10 +2804,12 @@ static void flush_to_ldisc(void *private + disc->receive_buf(tty, char_buf, flag_buf, count); + spin_lock_irqsave(&tty->buf.lock, flags); + } +- if (tbuf->active) ++ if (tbuf->active) { ++ tty->buf.head = head; + break; +- tty->buf.head = tbuf->next; +- if (tty->buf.head == NULL) ++ } ++ head = tbuf->next; ++ if (head == NULL) + tty->buf.tail = NULL; + tty_buffer_free(tty, tbuf); + } -- 2.47.3