From: akpm@linux-foundation.org
To: mm-commits@vger.kernel.org
Cc: Rupesh.Sugathan@gmail.com, alan@lxorguk.ukuu.org.uk,
paulkf@microgate.com
Subject: + n_tty-loss-of-sync-following-a-buffer-overflow.patch added to -mm tree
Date: Tue, 11 Mar 2008 21:55:04 -0700 [thread overview]
Message-ID: <200803120455.m2C4t4Aw010881@imap1.linux-foundation.org> (raw)
The patch titled
n_tty: loss of sync following a buffer overflow
has been added to the -mm tree. Its filename is
n_tty-loss-of-sync-following-a-buffer-overflow.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
Subject: n_tty: loss of sync following a buffer overflow
From: Rupesh Sugathan <Rupesh.Sugathan@gmail.com>
There seems to be a synchronization issue with the n_tty.c driver when working
in canonical mode.
The n_tty rightly discards data received following a buffer overflow and hence
the tty->read_cnt is not updated. However, the newline characters received
following a buffer overflow seems to increment the tty->canon_data index.
This may result in a loss of sync between the tty->canon_data & tty->read_cnt
while processing read in the read_chan(). This loss of sync might be
irrecoverable even when the data is later received at a slower rate.
I am not very sure if there is any deliberate rationale to process the
newlines even when the buffer has overflown.
Signed-off-by: Rupesh Sugathan <Rupesh.Sugathan@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/char/n_tty.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff -puN drivers/char/n_tty.c~n_tty-loss-of-sync-following-a-buffer-overflow drivers/char/n_tty.c
--- a/drivers/char/n_tty.c~n_tty-loss-of-sync-following-a-buffer-overflow
+++ a/drivers/char/n_tty.c
@@ -850,15 +850,17 @@ send_signal:
put_tty_queue(c, tty);
handle_newline:
- spin_lock_irqsave(&tty->read_lock, flags);
- set_bit(tty->read_head, tty->read_flags);
- put_tty_queue_nolock(c, tty);
- tty->canon_head = tty->read_head;
- tty->canon_data++;
- spin_unlock_irqrestore(&tty->read_lock, flags);
- kill_fasync(&tty->fasync, SIGIO, POLL_IN);
- if (waitqueue_active(&tty->read_wait))
- wake_up_interruptible(&tty->read_wait);
+ if (tty->read_cnt < N_TTY_BUF_SIZE) {
+ spin_lock_irqsave(&tty->read_lock, flags);
+ set_bit(tty->read_head, tty->read_flags);
+ put_tty_queue_nolock(c, tty);
+ tty->canon_head = tty->read_head;
+ tty->canon_data++;
+ spin_unlock_irqrestore(&tty->read_lock, flags);
+ kill_fasync(&tty->fasync, SIGIO, POLL_IN);
+ if (waitqueue_active(&tty->read_wait))
+ wake_up_interruptible(&tty->read_wait);
+ }
return;
}
}
_
Patches currently in -mm which might be from Rupesh.Sugathan@gmail.com are
n_tty-loss-of-sync-following-a-buffer-overflow.patch
next reply other threads:[~2008-03-12 4:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-12 4:55 akpm [this message]
[not found] ` <20080312102729.58956d2c@the-village.bc.nu>
[not found] ` <47D7F531.2070400@microgate.com>
[not found] ` <1205339539.8873.14.camel@estonia>
2008-03-12 17:39 ` + n_tty-loss-of-sync-following-a-buffer-overflow.patch added to -mm tree Paul Fulghum
2008-03-12 21:01 ` Paul Fulghum
2008-03-12 20:54 ` Rupesh Sugathan
2008-03-12 23:40 ` Paul Fulghum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200803120455.m2C4t4Aw010881@imap1.linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=Rupesh.Sugathan@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=paulkf@microgate.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.