]> git.baikalelectronics.ru Git - kernel.git/commit
tty: Correct tty buffer flush.
authorIlya Zykov <ilya@ilyx.ru>
Sat, 19 Jan 2013 14:16:20 +0000 (18:16 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Jan 2013 23:50:36 +0000 (15:50 -0800)
commit090688fbe20a70948cef84cf01ef484940b11f57
treed935c8754648b783eb0b83834f8d8c16d917eebd
parent15495fff2f3b42f1b2658184eb109ea4807b3dec
tty: Correct tty buffer flush.

  The root of problem is carelessly zeroing pointer(in function __tty_buffer_flush()),
when another thread can use it. It can be cause of "NULL pointer dereference".
  Main idea of the patch, this is never free last (struct tty_buffer) in the active buffer.
Only flush the data for ldisc(buf->head->read = buf->head->commit).
At that moment driver can collect(write) data in buffer without conflict.
It is repeat behavior of flush_to_ldisc(), only without feeding data to ldisc.

Also revert:
  commit 3916ce3a82cf34b3b99b3eb96edacd76e74be66d
  tty: hold lock across tty buffer finding and buffer filling
In order to delete the unneeded locks any more.

Signed-off-by: Ilya Zykov <ilya@ilyx.ru>
CC: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/tty_buffer.c