Matthew Wilcox (Oracle) 2f373fdb25 ramfs: fix nommu mmap with gaps in the page cache
[ Upstream commit 50b7d85680086126d7bd91dae81d57d4cb1ab6b7 ]

ramfs needs to check that pages are both physically contiguous and
contiguous in the file.  If the page cache happens to have, eg, page A for
index 0 of the file, no page for index 1, and page A+1 for index 2, then
an mmap of the first two pages of the file will succeed when it should
fail.

Fixes: 642fb4d1f1dd ("[PATCH] NOMMU: Provide shared-writable mmap support on ramfs")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: David Howells <dhowells@redhat.com>
Link: https://lkml.kernel.org/r/20200914122239.GO6583@casper.infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-29 09:07:11 +01:00
..
2020-08-21 09:48:15 +02:00
2020-04-02 16:34:33 +02:00
2019-08-06 19:05:23 +02:00
2020-08-21 09:48:13 +02:00
2020-08-21 09:48:18 +02:00
2020-08-26 10:29:56 +02:00
2019-12-17 20:38:15 +01:00
2020-10-17 10:29:55 +02:00
2018-12-21 14:13:04 +01:00
2020-09-03 11:22:29 +02:00
2020-03-11 18:02:43 +01:00
2020-04-02 16:34:21 +02:00