[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240929230548.370027-3-gianf.trad@gmail.com>
Date: Mon, 30 Sep 2024 01:05:50 +0200
From: Gianfranco Trad <gianf.trad@...il.com>
To: willy@...radead.org,
akpm@...ux-foundation.org
Cc: linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
skhan@...uxfoundation.org,
Gianfranco Trad <gianf.trad@...il.com>,
syzbot+4089e577072948ac5531@...kaller.appspotmail.com
Subject: [PATCH v1] Fix NULL pointer dereference in read_cache_folio
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@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=4089e577072948ac5531
Tested-by: syzbot+4089e577072948ac5531@...kaller.appspotmail.com
Signed-off-by: Gianfranco Trad <gianf.trad@...il.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
Powered by blists - more mailing lists