[PATCH] xa_load() needs a NULL check before locking check

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

 



Signed-off-by: void0red <void0red@xxxxxxxxx>
---
 include/linux/pagemap.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index bbccb4044222..f1ddee3571de 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -1250,6 +1250,10 @@ static inline struct folio *__readahead_folio(struct readahead_control *ractl)
 	}
 
 	folio = xa_load(&ractl->mapping->i_pages, ractl->_index);
+	if (!folio) {
+		VM_BUG_ON(!folio);
+		return NULL;
+	}
 	VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
 	ractl->_batch_count = folio_nr_pages(folio);
 
-- 
2.34.1




[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