From: zhangliguang <zhangliguang@linux.alibaba.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH] fuse: fix a NULL pointer dereference
Date: Mon, 29 Apr 2019 14:13:39 +0800 [thread overview]
Message-ID: <1556518419-17986-1-git-send-email-zhangliguang@linux.alibaba.com> (raw)
In case kzalloc fails, the fix returns NULL to avoid NULL pointer
dereference.
Signed-off-by: zhangliguang <zhangliguang@linux.alibaba.com>
---
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
reply other threads:[~2019-04-29 6:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1556518419-17986-1-git-send-email-zhangliguang@linux.alibaba.com \
--to=zhangliguang@linux.alibaba.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).