[PATCH] fuse: fix a NULL pointer dereference

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

 



In case kzalloc fails, the fix returns NULL to avoid NULL pointer
dereference.

Signed-off-by: zhangliguang <zhangliguang@xxxxxxxxxxxxxxxxx>
---
 fs/fuse/dev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 9971a35..23e73d8 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -61,6 +61,9 @@ static struct page **fuse_req_pages_alloc(unsigned int npages, gfp_t flags,
 
 	pages = kzalloc(npages * (sizeof(struct page *) +
 				  sizeof(struct fuse_page_desc)), flags);
+	if (!pages)
+		return NULL;
+
 	*desc = (void *) pages + npages * sizeof(struct page *);
 
 	return pages;
-- 
1.8.3.1




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

  Powered by Linux