Files
linux/drivers
Alan Cox 42fd552e86 fix serial buffer memory leak
Patch c5c34d4862 (tty: flush flip buffer on
ldisc input queue flush) introduces a race condition which can lead to memory
leaks.

The problem can be triggered when tcflush() is called when data are being
pushed to the line discipline driver by flush_to_ldisc().

flush_to_ldisc() releases tty->buf.lock when calling the line discipline
receive_buf function. At that poing tty_buffer_flush() kicks in and sets both
tty->buf.head and tty->buf.tail to NULL. When flush_to_ldisc() finishes, it
restores tty->buf.head but doesn't touch tty->buf.tail. This corrups the
buffer queue, and the next call to tty_buffer_request_room() will allocate a
new buffer and overwrite tty->buf.head. The previous buffer is then lost
forever without being released.

(Thanks to Laurent for the above text, for finding, disgnosing and reporting
the bug)

- Use tty->flags bits for the flush status.

- Wait for the flag to clear again before returning

- Fix the doc error noted

- Fix flush of empty queue leaving stale flushpending

[akpm@linux-foundation.org: cleanup]
Signed-off-by: Alan Cox <alan@redhat.com>
Acked-by: Paul Fulghum <paulkf@microgate.com>
Cc: Laurent Pinchart <laurentp@cse-semaphore.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-08-11 15:47:41 -07:00
..
2007-07-31 15:39:39 -07:00
…
2007-08-06 16:10:54 +01:00
2007-07-18 02:13:42 -07:00
2007-07-31 15:39:39 -07:00
2007-07-31 15:39:43 -07:00
2007-08-11 15:47:41 -07:00
2007-07-21 18:37:12 -07:00
2007-07-16 09:05:40 -07:00
…
…
…
2007-07-16 09:05:42 -07:00
2007-07-30 21:14:00 -04:00
2007-08-01 23:46:46 +02:00
2007-07-31 15:39:40 -07:00
…
…
2007-08-03 12:42:40 +01:00
2007-08-07 17:36:20 -04:00
2007-07-20 14:25:51 +10:00
2007-07-31 15:39:37 -07:00
2007-07-29 16:53:59 -07:00
…
2007-07-31 15:39:44 -07:00
2007-07-18 08:38:22 -07:00
2007-07-18 15:57:16 -07:00
2007-07-26 11:11:57 -07:00
2007-07-26 11:35:17 -07:00
2007-07-20 13:39:59 +10:00
2007-07-29 18:58:39 +00:00