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-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. Please comment and review the patch diff -pu a/drivers/char/n_tty.c b/drivers/char/n_tty.c --- a/drivers/char/n_tty.c 2008-03-10 17:11:54.000000000 -0700 +++ b/drivers/char/n_tty.c 2008-03-10 16:49:23.000000000 -0700 @@ -838,15 +838,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; } } Signed-off-by: Rupesh Sugathan <Rupesh.Sugathan@gmail.com> --
| Linus Torvalds | Linux 2.6.27-rc8 |
| Rafael J. Wysocki | 2.6.26-rc9-git12: Reported regressions from 2.6.25 |
| Alan Cox | [PATCH 00/76] Queued TTY Patches |
| James Bottomley | Re: Integration of SCST in the mainstream Linux kernel |
git: | |
| Shawn O. Pearce | Re: cleaner/better zlib sources? |
| sbejar | Re: Using GIT to store /etc (Or: How to make GIT store all file permission bits) |
| Mark Levedahl | mingw, windows, crlf/lf, and git |
| bain | [Announce] teamGit v0.0.3 |
| Richard Stallman | Real men don't attack straw men |
| Leon Dippenaar | New tcp stack attack |
| Jonathan Thornburg | svnd questions (encrypting all of a partition or disk) |
| Chris Bullock | OpenBSD isakmpd and pf vs Cisco PIX or ASA |
| Gerrit Renker | [PATCH 0/37] dccp: Feature negotiation - last call for comments |
| Dushan Tcholich | Re: ksoftirqd high cpu load on kernels 2.6.24 to 2.6.27-rc1-mm1 |
| Jarek Poplawski | Re: [PATCH] Fix routing tables with id > 255 for legacy software |
| Evgeniy Polyakov | Re: [Bugme-new] [Bug 10556] New: IPVS sync_backup oops |
