Jan Kara 2d605d9188 ext4: fix data corruption for mmap writes
commit a056bdaae7a181f7dcc876cfab2f94538e508709 upstream.

mpage_submit_page() can race with another process growing i_size and
writing data via mmap to the written-back page. As mpage_submit_page()
samples i_size too early, it may happen that ext4_bio_write_page()
zeroes out too large tail of the page and thus corrupts user data.

Fix the problem by sampling i_size only after the page has been
write-protected in page tables by clear_page_dirty_for_io() call.

Reported-by: Michael Zimmer <michael@swarm64.com>
Fixes: cb20d5188366f04d96d2e07b1240cc92170ade40
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-12 11:51:26 +02:00
..
2017-05-14 14:00:13 +02:00
2016-10-15 12:09:13 -07:00
2017-09-07 08:35:40 +02:00
2017-08-06 18:59:43 -07:00
2017-10-08 10:26:10 +02:00
2017-06-14 15:06:00 +02:00
2017-08-06 18:59:43 -07:00
2017-10-08 10:26:11 +02:00
2017-07-05 14:40:26 +02:00
2017-06-14 15:06:00 +02:00
2017-06-14 15:06:00 +02:00
2016-09-27 21:20:53 -04:00
2017-08-06 18:59:43 -07:00
2017-06-14 15:06:00 +02:00
2017-07-12 15:01:02 +02:00
2016-09-27 18:47:38 -04:00
2016-06-21 09:23:11 +10:00
2017-06-14 15:06:00 +02:00
2017-08-06 18:59:43 -07:00
2017-06-14 15:06:01 +02:00