From: "Timo Teräs" <timo.teras@iki.fi>
To: Dan Carpenter <error27@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: bug report: xfrm: potential null deref in xfrm_bundle_lookup()
Date: Sun, 23 May 2010 21:06:31 +0300 [thread overview]
Message-ID: <4BF96EA7.9050101@iki.fi> (raw)
In-Reply-To: <20100522202430.GN22515@bicker>
On 05/22/2010 11:24 PM, Dan Carpenter wrote:
> This is a smatch thing. I couldn't tell if it was a real issue so I
> thought I would send this mail to the experts. :)
>
> net/xfrm/xfrm_policy.c +1679 xfrm_bundle_lookup(51)
> error: we previously assumed 'xdst' could be null.
> 1672 new_xdst = xfrm_resolve_and_create_bundle(pols, num_pols, fl, family, dst_orig);
> 1673 if (IS_ERR(new_xdst)) {
> 1674 err = PTR_ERR(new_xdst);
> 1675 if (err != -EAGAIN)
> 1676 goto error;
> 1677 if (oldflo == NULL)
> 1678 goto make_dummy_bundle;
> 1679 dst_hold(&xdst->u.dst);
> ^^^^^^^^^^^
> Can xdst be NULL here? It would have to be something like
> oldflo gets passed in as null and __xfrm_policy_lookup() fails.
No. xdst and oldflo point to same data structure, just to different
offset (and data type). If oldflo is not null, xdst is not either. See
their initialization around lines 1640. Since oldflo is explicitly
tested for not being null, xdst is valid too.
It might make this more obvious if we tested xdst for NULL instead of
oldflo, though.
- Timo
next prev parent reply other threads:[~2010-05-23 18:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-22 20:24 bug report: xfrm: potential null deref in xfrm_bundle_lookup() Dan Carpenter
2010-05-23 18:06 ` Timo Teräs [this message]
2010-05-23 19:38 ` Dan Carpenter
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=4BF96EA7.9050101@iki.fi \
--to=timo.teras@iki.fi \
--cc=error27@gmail.com \
--cc=netdev@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.