From: Paolo Abeni <pabeni@redhat.com>
To: Young Xiao <92siuyang@gmail.com>,
davem@davemloft.net, petrm@mellanox.com,
roopa@cumulusnetworks.com, idosch@mellanox.com,
sbrivio@redhat.com, netdev@vger.kernel.org
Subject: Re: [PATCH] net/vxlan: fix potential null pointer deference
Date: Fri, 31 May 2019 10:50:41 +0200 [thread overview]
Message-ID: <cf215a1abc1e2fd7c8015ac93b369de530cbb9d3.camel@redhat.com> (raw)
In-Reply-To: <1559291681-6002-1-git-send-email-92siuyang@gmail.com>
On Fri, 2019-05-31 at 16:34 +0800, Young Xiao wrote:
> There is a possible null pointer deference bug in vxlan_fdb_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>
> ---
> drivers/net/vxlan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index 5994d54..1ba5977 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -274,7 +274,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
> } else
> ndm->ndm_family = AF_BRIDGE;
> ndm->ndm_state = fdb->state;
> - ndm->ndm_ifindex = vxlan->dev->ifindex;
> + ndm->ndm_ifindex = vxlan->dev ? vxlan->dev->ifindex : 0;
> ndm->ndm_flags = fdb->flags;
> if (rdst->offloaded)
> ndm->ndm_flags |= NTF_OFFLOADED;
vxlan->dev points to the struct net_device for this vxlan device. It
can't be NULL.
I suggest to look for working reproducer for this kind of issue before
adding additional, unneeded, checks. We want to avoid as many unneeded
conditionals as possible.
Thanks,
Paolo
next prev parent reply other threads:[~2019-05-31 8:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-31 8:34 [PATCH] net/vxlan: fix potential null pointer deference Young Xiao
2019-05-31 8:50 ` Paolo Abeni [this message]
2019-05-31 15:00 ` 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=cf215a1abc1e2fd7c8015ac93b369de530cbb9d3.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=92siuyang@gmail.com \
--cc=davem@davemloft.net \
--cc=idosch@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=petrm@mellanox.com \
--cc=roopa@cumulusnetworks.com \
--cc=sbrivio@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox