Unverified Commit 4bcac70a authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!4369 mm/filemap: avoid buffered read/write race to read inconsistent data

parents 0ec2c5ee 6927b17e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -2273,6 +2273,15 @@ static ssize_t generic_file_buffered_read(struct kiocb *iocb,
		}
		nr = nr - offset;

		/*
		 * Pairs with a barrier in
		 * block_write_end()->mark_buffer_dirty() or other page
		 * dirtying routines like iomap_write_end() to ensure
		 * changes to page contents are visible before we see
		 * increased inode size.
		 */
		smp_rmb();

		/* If users can be writing to this page using arbitrary
		 * virtual addresses, take care about potential aliasing
		 * before reading the page on the kernel side.