From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Xiubo Li <lixiubo@cmss.chinamobile.com>
Cc: kaber@trash.net, kadlec@blackhole.kfki.hu, davem@davemloft.net,
netfilter-devel@vger.kernel.org, netfilter@vger.kernel.org,
coreteam@netfilter.org, netdev@vger.kernel.org
Subject: Re: [PATCH v2] netfilter: fix possible ZERO_SIZE_PTR pointer dereferencing error.
Date: Thu, 23 Jun 2016 12:12:53 +0200 [thread overview]
Message-ID: <20160623101253.GA9665@salvia> (raw)
In-Reply-To: <1464836396-15671-1-git-send-email-lixiubo@cmss.chinamobile.com>
On Thu, Jun 02, 2016 at 10:59:56AM +0800, Xiubo Li wrote:
> Since we cannot make sure that the 'hook_mask' will always be none
> zero here. If it equals to zero, the num_hooks will be zero too,
> and then kmalloc() will return ZERO_SIZE_PTR, which is (void *)16.
>
> Then the following error check will fails:
> ops = kmalloc(sizeof(*ops) * num_hooks, GFP_KERNEL);
> if (ops == NULL)
> return ERR_PTR(-ENOMEM);
>
> So this patch will fix this with just doing the zero check before
> kmalloc() is called.
>
> Maybe the case above will never happen here, but in theory.
Applied, thanks.
prev parent reply other threads:[~2016-06-23 10:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-02 2:59 [PATCH v2] netfilter: fix possible ZERO_SIZE_PTR pointer dereferencing error Xiubo Li
2016-06-23 10:12 ` Pablo Neira Ayuso [this message]
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=20160623101253.GA9665@salvia \
--to=pablo@netfilter.org \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=kaber@trash.net \
--cc=kadlec@blackhole.kfki.hu \
--cc=lixiubo@cmss.chinamobile.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=netfilter@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.