Skip to contentSkip to conversation

fuse: fix a NULL pointer dereference

PATCH New zhangliguang 1 participant 1 message Apr 29, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fuse: fix a NULL pointer dereference

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

---
 fs/fuse/dev.c | 3 +++
 1 file changed, 3 insertions(+)
fs/fuse/dev.c +3 -0
index 9971a35..23e73d8 100644
@@ -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;
Signature · 1 line
1.8.3.1