Commit 38a55db9 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Linus Torvalds

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: 66dabbb6 ("mm: return an ERR_PTR from __filemap_get_folio")
Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Reported-by: syzbot+48011b86c8ea329af1b9@syzkaller.appspotmail.com
Reported-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent dd9e11d6
...@@ -3378,7 +3378,7 @@ vm_fault_t filemap_fault(struct vm_fault *vmf) ...@@ -3378,7 +3378,7 @@ vm_fault_t filemap_fault(struct vm_fault *vmf)
* re-find the vma and come back and find our hopefully still populated * re-find the vma and come back and find our hopefully still populated
* page. * page.
*/ */
if (folio) if (!IS_ERR(folio))
folio_put(folio); folio_put(folio);
if (mapping_locked) if (mapping_locked)
filemap_invalidate_unlock_shared(mapping); filemap_invalidate_unlock_shared(mapping);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment