android_kernel_xiaomi_sm8350/include
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
..
acpi ACPI: restore CONFIG_ACPI_SLEEP 2007-07-29 16:53:59 -07:00
asm-alpha Fix Alpha O_CLOEXEC definition 2007-08-09 08:39:22 -07:00
asm-arm [ARM] 4531/1: remove is_in_rom() protptype 2007-08-04 22:13:43 +01:00
asm-avr32 Fix WARN_ON() on bitfield ops for all other archs 2007-08-01 20:45:38 -07:00
asm-blackfin remove unused TIF_NOTIFY_RESUME flag 2007-07-31 15:39:38 -07:00
asm-cris remove unused TIF_NOTIFY_RESUME flag 2007-07-31 15:39:38 -07:00
asm-frv FRV: connect up fallocate 2007-08-11 15:47:40 -07:00
asm-generic Fix WARN_ON() on bitfield ops 2007-07-31 21:12:07 -07:00
asm-h8300 remove unused TIF_NOTIFY_RESUME flag 2007-07-31 15:39:38 -07:00
asm-i386 revert "x86, serial: convert legacy COM ports to platform devices" 2007-07-31 15:39:38 -07:00
asm-ia64 remove unused TIF_NOTIFY_RESUME flag 2007-07-31 15:39:38 -07:00
asm-m32r remove unused TIF_NOTIFY_RESUME flag 2007-07-31 15:39:38 -07:00
asm-m68k more include order horrors 2007-07-28 19:42:21 -07:00
asm-m68knommu remove unused TIF_NOTIFY_RESUME flag 2007-07-31 15:39:38 -07:00
asm-mips Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus 2007-07-31 20:41:53 -07:00
asm-parisc Fix WARN_ON() on bitfield ops for all other archs 2007-08-01 20:45:38 -07:00
asm-powerpc [POWERPC] Fixes for the SLB shadow buffer code 2007-08-03 19:36:01 +10:00
asm-ppc [WATCHDOG] mv64x60_wdt: Add arch/powerpc platform support 2007-07-24 21:16:02 +00:00
asm-s390 Fix WARN_ON() on bitfield ops for all other archs 2007-08-01 20:45:38 -07:00
asm-sh Merge master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6.23 2007-08-03 15:07:10 -07:00
asm-sh64 sh64: Kill off virt_to_bus()/bus_to_virt(). 2007-07-31 13:11:25 +09:00
asm-sparc [SPARC]: Centralize find_in_proplist() instead of duplicating N times. 2007-08-07 18:46:36 -07:00
asm-sparc64 [SPARC64]: Do not assume sun4v chips have load-twin/store-init support. 2007-08-08 17:33:45 -07:00
asm-um
asm-v850 remove unused TIF_NOTIFY_RESUME flag 2007-07-31 15:39:38 -07:00
asm-x86_64 revert "x86, serial: convert legacy COM ports to platform devices" 2007-07-31 15:39:38 -07:00
asm-xtensa remove unused TIF_NOTIFY_RESUME flag 2007-07-31 15:39:38 -07:00
crypto
keys
linux fix serial buffer memory leak 2007-08-11 15:47:41 -07:00
math-emu
media
mtd
net [NETFILTER]: nf_nat: add symbolic dependency on IPv4 conntrack 2007-08-07 18:12:01 -07:00
pcmcia
rdma
rxrpc
scsi [SCSI] sd: disentangle barriers in SCSI 2007-08-04 08:37:04 -05:00
sound
video remove tx3912fb 2007-07-31 15:39:41 -07:00
xen xen: xen/page.h compile fix 2007-07-26 11:35:16 -07:00
Kbuild