linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] filemap: don't unlock null page in FGP_FOR_MMAP case
@ 2019-03-12 20:17 Josef Bacik
  2019-03-12 21:06 ` Andrew Morton
  2019-03-12 21:08 ` Rik van Riel
  0 siblings, 2 replies; 4+ messages in thread
From: Josef Bacik @ 2019-03-12 20:17 UTC (permalink / raw)
  To: akpm, linux-mm, kernel-team

We noticed a panic happening in production with the filemap fault pages
because we were unlocking a NULL page.  If add_to_page_cache() fails
then we'll have a NULL page, so fix this check to only unlock if we
have a valid page.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 mm/filemap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index cace3eb8069f..2815cb79a246 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1663,7 +1663,7 @@ struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset,
 		 * add_to_page_cache_lru locks the page, and for mmap we expect
 		 * an unlocked page.
 		 */
-		if (fgp_flags & FGP_FOR_MMAP)
+		if (page && (fgp_flags & FGP_FOR_MMAP))
 			unlock_page(page);
 	}
 
-- 
2.14.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-13 14:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-12 20:17 [PATCH] filemap: don't unlock null page in FGP_FOR_MMAP case Josef Bacik
2019-03-12 21:06 ` Andrew Morton
2019-03-13 14:25   ` Josef Bacik
2019-03-12 21:08 ` Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox