Matthew Wilcox (Oracle) c5df8ff043 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:57:53 +01:00
..
2020-08-19 08:16:24 +02:00
2019-09-19 09:42:37 -07:00
2020-08-19 08:16:21 +02:00
2019-09-19 09:42:37 -07:00
2020-08-26 10:40:56 +02:00
2019-09-19 09:42:37 -07:00
2019-07-03 17:52:09 -04:00
2020-10-17 10:11:23 +02:00
2020-06-17 16:40:24 +02:00
2020-09-03 11:26:57 +02:00
2020-03-05 16:43:36 +01:00
2020-10-01 13:17:19 +02:00
2019-08-07 21:51:47 -04:00
2020-03-25 08:25:58 +01:00
2019-12-17 19:55:30 +01:00
2019-09-18 16:59:14 -07:00
2019-09-18 16:59:14 -07:00
2020-05-06 08:15:15 +02:00
2019-08-01 20:51:23 +02:00