From: Matthew Wilcox Date: Sat, 6 May 2023 16:04:14 +0000 (+0100) Subject: filemap: Handle error return from __filemap_get_folio() X-Git-Tag: v6.6.7~2878 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=38a55db9877cae9aa9cc53bb0464b7434fb03e75;p=platform%2Fkernel%2Flinux-starfive.git filemap: Handle error return from __filemap_get_folio() Smatch reports that filemap_fault() was missed in the conversion of __filemap_get_folio() error returns from NULL to ERR_PTR. Fixes: 66dabbb65d67 ("mm: return an ERR_PTR from __filemap_get_folio") Reported-by: Dan Carpenter Reported-by: syzbot+48011b86c8ea329af1b9@syzkaller.appspotmail.com Reported-by: Christoph Hellwig Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Linus Torvalds --- diff --git a/mm/filemap.c b/mm/filemap.c index a34abfe..b4c9bd3 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3378,7 +3378,7 @@ out_retry: * re-find the vma and come back and find our hopefully still populated * page. */ - if (folio) + if (!IS_ERR(folio)) folio_put(folio); if (mapping_locked) filemap_invalidate_unlock_shared(mapping);