[PATCH v2] Fix NULL pointer dereference in read_cache_folio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://syzkaller.appspot.com/bug?extid=4089e577072948ac5531
Tested-by: syzbot+4089e577072948ac5531@xxxxxxxxxxxxxxxxxxxxxxxxx
Signed-off-by: Gianfranco Trad <gianf.trad@xxxxxxxxx>
---

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





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux