public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Cong Wang <amwang@redhat.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Subject: Re: [Patch net-next] ipv6: fix a potential NULL deref
Date: Mon, 29 Oct 2012 09:25:13 +0100	[thread overview]
Message-ID: <1351499113.7394.171.camel@edumazet-glaptop> (raw)
In-Reply-To: <1351495523.8221.8.camel@cr0>

On Mon, 2012-10-29 at 15:25 +0800, Cong Wang wrote:

> Oh, yeah, gcc should be smart enough to do calculation without deref it
> given it has the offset and the address. And dst happens to be first
> field of rt, so offset is 0, &rt->dst should be NULL too if rt is NULL.
> 

There is no dereference, even if gcc was dumb, since dst is an embedded
struct, not a pointer to a struct.

This wont change in a near future.

> But this will be a problem if someone moved dst inside rt, as there is
> no comment saying dst has to be the first one?

I dont think this placement will change in a near future, it would break
lot of things.

I guess we can use a BUILD_BUG_ON() instead of a comment that
could be ignored.

Note we could move dst in rtable, if we change the NULL test in
dst_release with some if ((unsigned long)dst < 4000) condition

I'll send a patch against ip_rt_put()

  reply	other threads:[~2012-10-29  8:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-29  3:50 [Patch net-next] ipv6: fix a potential NULL deref Cong Wang
2012-10-29  6:10 ` Eric Dumazet
2012-10-29  6:49   ` Cong Wang
2012-10-29  7:05     ` Eric Dumazet
2012-10-29  7:25       ` Cong Wang
2012-10-29  8:25         ` Eric Dumazet [this message]
2012-10-29 17:29         ` David Miller
2012-10-30  1:44           ` Cong Wang
2012-10-29 17:22     ` David Miller
2012-10-29  8:16   ` [Patch net-next] ipv6: remove another useless NULL check Cong Wang
2012-10-29  8:33     ` Eric Dumazet
2012-10-29  9:08       ` Cong Wang

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=1351499113.7394.171.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=amwang@redhat.com \
    --cc=davem@davemloft.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox