[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240930090225.28517-2-gianf.trad@gmail.com>
Date: Mon, 30 Sep 2024 11:02:26 +0200
From: Gianfranco Trad <gianf.trad@...il.com>
To: gianf.trad@...il.com
Cc: akpm@...ux-foundation.org,
linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
skhan@...uxfoundation.org,
syzbot+4089e577072948ac5531@...kaller.appspotmail.com,
willy@...radead.org
Subject: [PATCH v2] 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>
---
Notes:
changes in v2:
- refactored check on filler.
mm/filemap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/filemap.c b/mm/filemap.c
index 4f3753f0a158..88de8029133c 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2360,6 +2360,8 @@ 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);
+ if (!filler)
+ return -EIO;
error = filler(file, folio);
if (unlikely(workingset))
psi_memstall_leave(&pflags);
--
2.43.0
Powered by blists - more mailing lists