netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Tejaswi Tanikella <tejaswit@codeaurora.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] netfilter: ipv4: Fix use-after-free in send_reset
Date: Wed, 1 Nov 2017 17:59:38 +0100	[thread overview]
Message-ID: <20171101165938.GA3129@salvia> (raw)
In-Reply-To: <20171101003636.GA29237@salvia>

On Wed, Nov 01, 2017 at 01:36:36AM +0100, Pablo Neira Ayuso wrote:
> On Mon, Oct 23, 2017 at 11:46:03AM +0530, Tejaswi Tanikella wrote:
> > niph is not updated after pskb_expand_head changes the skb head.
> > It still points to the freed data, which is then used to update
> > tot_len and checksum. This could cause use-after-free poison crash.
> > 
> > Update niph, if ip_route_me_harder does not fail.
> > 
> > Signed-off-by: Tejaswi Tanikella <tejaswit@codeaurora.org>
> > ---
> >  net/ipv4/netfilter/nf_reject_ipv4.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/net/ipv4/netfilter/nf_reject_ipv4.c b/net/ipv4/netfilter/nf_reject_ipv4.c
> > index eeacbda..b2e0f90 100644
> > --- a/net/ipv4/netfilter/nf_reject_ipv4.c
> > +++ b/net/ipv4/netfilter/nf_reject_ipv4.c
> > @@ -131,6 +131,8 @@ void nf_send_reset(struct net *net, struct sk_buff *oldskb, int hook)
> >  
> >  	if (ip_route_me_harder(net, nskb, RTN_UNSPEC))
> >  		goto free_nskb;
> > +	else
> > +		niph = ip_hdr(nskb);
> 
> No need for else here, right? So we can just turn this into a one
> liner to inconditionally reload this pointer.

I'm just going to remove the 'else' and push out this.

      reply	other threads:[~2017-11-01 16:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-23  6:16 [PATCH] netfilter: ipv4: Fix use-after-free in send_reset Tejaswi Tanikella
2017-11-01  0:36 ` Pablo Neira Ayuso
2017-11-01 16:59   ` 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=20171101165938.GA3129@salvia \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=tejaswit@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).