linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] Fix NULL pointer dereference in read_cache_folio
@ 2024-09-29 23:05 Gianfranco Trad
  2024-09-30  9:02 ` [PATCH v2] " Gianfranco Trad
  0 siblings, 1 reply; 6+ messages in thread
From: Gianfranco Trad @ 2024-09-29 23:05 UTC (permalink / raw)
  To: willy, akpm
  Cc: linux-fsdevel, linux-mm, linux-kernel, skhan, Gianfranco Trad,
	syzbot+4089e577072948ac5531

Add check on filler to prevent NULL pointer dereference condition in
read_cache_folio[1].

[1] https://syzkaller.appspot.com/bug?extid=4089e577072948ac5531

Reported-by: syzbot+4089e577072948ac5531@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=4089e577072948ac5531
Tested-by: syzbot+4089e577072948ac5531@syzkaller.appspotmail.com
Signed-off-by: Gianfranco Trad <gianf.trad@gmail.com>
---
 mm/filemap.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 4f3753f0a158..960f389e2d3b 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2360,7 +2360,10 @@ static int filemap_read_folio(struct file *file, filler_t filler,
 	/* Start the actual read. The read will unlock the page. */
 	if (unlikely(workingset))
 		psi_memstall_enter(&pflags);
-	error = filler(file, folio);
+	if (filler)
+		error = filler(file, folio);
+	else
+		return -EIO;
 	if (unlikely(workingset))
 		psi_memstall_leave(&pflags);
 	if (error)
-- 
2.43.0


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

end of thread, other threads:[~2024-10-15 11:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-29 23:05 [PATCH v1] Fix NULL pointer dereference in read_cache_folio Gianfranco Trad
2024-09-30  9:02 ` [PATCH v2] " Gianfranco Trad
2024-09-30 17:02   ` Andrew Morton
2024-09-30 18:14   ` Matthew Wilcox
2024-10-04 12:07     ` Gianfranco Trad
2024-10-15 11:57       ` [PATCH v2] mm: fix null " Gianfranco Trad

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).