Dmitry Vyukov facd885c75 tty: fix data race on tty_buffer.commit
Race on buffer data happens when newly committed data is
picked up by an old flush work in the following scenario:
__tty_buffer_request_room does a plain write of tail->commit,
no barriers were executed before that.
At this point flush_to_ldisc reads this new value of commit,
and reads buffer data, no barriers in between.
The committed buffer data is not necessary visible to flush_to_ldisc.

Similar bug happens when tty_schedule_flip commits data.

Update commit with smp_store_release and read commit with
smp_load_acquire, as it is commit that signals data readiness.
This is orthogonal to the existing synchronization on tty_buffer.next,
which is required to not dismiss a buffer with unconsumed data.

The data race was found with KernelThreadSanitizer (KTSAN).

Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04 19:03:40 +01:00
..
2015-09-26 20:54:53 -04:00
2015-09-08 16:48:55 -07:00
2015-09-04 11:35:03 -07:00
2015-09-11 16:21:12 -07:00
2015-09-27 06:45:18 -04:00
2015-09-08 14:35:59 -07:00
2015-09-03 16:41:38 -07:00
2015-09-11 16:42:39 -07:00
2015-09-08 17:22:35 -07:00
2015-09-26 20:53:15 -04:00
2015-09-08 16:33:16 -07:00
2015-09-09 11:17:33 -07:00
2015-09-25 11:16:53 -07:00
2015-09-17 21:41:02 -07:00
2015-09-09 10:55:32 -07:00
2015-09-05 19:37:31 +02:00
2015-09-18 09:28:20 -07:00
2015-09-21 12:02:27 -07:00
2015-09-26 20:56:50 -04:00
2015-09-18 09:28:20 -07:00