From: Pablo Neira Ayuso <pablo@netfilter.org>
To: subashab@codeaurora.org
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] netfilter: nf_nat: Fix possible null dereference
Date: Fri, 10 Jul 2015 00:24:56 +0200 [thread overview]
Message-ID: <20150709222456.GA4111@salvia> (raw)
In-Reply-To: <fea9df65d6768053838fb1eca1846ef7.squirrel@www.codeaurora.org>
On Thu, Jul 09, 2015 at 01:23:58AM -0000, subashab@codeaurora.org wrote:
> Fix an issue where __nf_ct_ext_find() could return null to nat in
> nf_nat_masquerade_ipv4() and could be dereferenced.
>
> This was detected by static analysis software.
>
> Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
> ---
> net/ipv4/netfilter/nf_nat_masquerade_ipv4.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
> b/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
> index c6eb421..4be5d70 100644
> --- a/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
> +++ b/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
> @@ -38,6 +38,8 @@ nf_nat_masquerade_ipv4(struct sk_buff *skb, unsigned int
> hooknum,
>
> ct = nf_ct_get(skb, &ctinfo);
> nat = nfct_nat(ct);
> + if (!nat)
> + return NF_DROP;
This function is called from nf_nat_ipv4_fn(), see do_chain().
And we're accepting the packet with no NAT mangling if we fail to add
the extension:
nat = nf_ct_nat_ext_add(ct);
if (nat == NULL)
return NF_ACCEPT;
Can you provide more information on what your static analysis software
reports? Thanks.
next prev parent reply other threads:[~2015-07-09 22:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-09 1:23 [PATCH] netfilter: nf_nat: Fix possible null dereference subashab
2015-07-09 22:24 ` Pablo Neira Ayuso [this message]
2015-07-09 23:16 ` subashab
2015-07-13 15:50 ` Pablo Neira Ayuso
2015-07-15 1:10 ` subashab
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=20150709222456.GA4111@salvia \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=subashab@codeaurora.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 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).