All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Young Xiao <92siuyang@gmail.com>,
	davem@davemloft.net, dsahern@gmail.com,
	roopa@cumulusnetworks.com, christian@brauner.io,
	khlebnikov@yandex-team.ru, netdev@vger.kernel.org
Subject: Re: [PATCH] net/neighbour: fix potential null pointer deference
Date: Fri, 31 May 2019 10:42:25 +0200	[thread overview]
Message-ID: <4105f63de712c8aa462aff6e3042d8689f68a33f.camel@redhat.com> (raw)
In-Reply-To: <1559291383-5814-1-git-send-email-92siuyang@gmail.com>

On Fri, 2019-05-31 at 16:29 +0800, Young Xiao wrote:
> There is a possible null pointer deference bugs in neigh_fill_info(),
> which is similar to the bug which was fixed in commit 6adc5fd6a142
> ("net/neighbour: fix crash at dumping device-agnostic proxy entries").
> 
> Signed-off-by: Young Xiao <92siuyang@gmail.com>
> ---
>  net/core/neighbour.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> index dfa8710..33c3ff1 100644
> --- a/net/core/neighbour.c
> +++ b/net/core/neighbour.c
> @@ -2440,7 +2440,7 @@ static int neigh_fill_info(struct sk_buff *skb, struct neighbour *neigh,
>  	ndm->ndm_pad2    = 0;
>  	ndm->ndm_flags	 = neigh->flags;
>  	ndm->ndm_type	 = neigh->type;
> -	ndm->ndm_ifindex = neigh->dev->ifindex;
> +	ndm->ndm_ifindex = neigh->dev ? neigh->dev->ifindex : 0;
>  
>  	if (nla_put(skb, NDA_DST, neigh->tbl->key_len, neigh->primary_key))
>  		goto nla_put_failure;

AFAICS, neigh->dev is requested to be != NULL at neighbour creation
time (see ___neigh_create()), so the above NULL ptr dereference looks
impossible. Am I missing something?

Thanks,

Paolo




  parent reply	other threads:[~2019-05-31  8:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31  8:29 [PATCH] net/neighbour: fix potential null pointer deference Young Xiao
2019-05-31  8:41 ` Konstantin Khlebnikov
2019-05-31  8:42 ` Paolo Abeni [this message]
2019-05-31 14:56 ` Eric Dumazet

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=4105f63de712c8aa462aff6e3042d8689f68a33f.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=92siuyang@gmail.com \
    --cc=christian@brauner.io \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=khlebnikov@yandex-team.ru \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@cumulusnetworks.com \
    /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.