* [PATCH] net/vxlan: fix potential null pointer deference
@ 2019-05-31 8:34 Young Xiao
2019-05-31 8:50 ` Paolo Abeni
2019-05-31 15:00 ` Eric Dumazet
0 siblings, 2 replies; 3+ messages in thread
From: Young Xiao @ 2019-05-31 8:34 UTC (permalink / raw)
To: davem, petrm, roopa, idosch, sbrivio, netdev; +Cc: Young Xiao
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;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] net/vxlan: fix potential null pointer deference
2019-05-31 8:34 [PATCH] net/vxlan: fix potential null pointer deference Young Xiao
@ 2019-05-31 8:50 ` Paolo Abeni
2019-05-31 15:00 ` Eric Dumazet
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Abeni @ 2019-05-31 8:50 UTC (permalink / raw)
To: Young Xiao, davem, petrm, roopa, idosch, sbrivio, netdev
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] net/vxlan: fix potential null pointer deference
2019-05-31 8:34 [PATCH] net/vxlan: fix potential null pointer deference Young Xiao
2019-05-31 8:50 ` Paolo Abeni
@ 2019-05-31 15:00 ` Eric Dumazet
1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2019-05-31 15:00 UTC (permalink / raw)
To: Young Xiao, davem, petrm, roopa, idosch, sbrivio, netdev
On 5/31/19 1:34 AM, 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;
>
Please provide a stack trace, and/or a Fixes: tag, and a detailed
analysis.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-31 15:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-31 8:34 [PATCH] net/vxlan: fix potential null pointer deference Young Xiao
2019-05-31 8:50 ` Paolo Abeni
2019-05-31 15:00 ` Eric Dumazet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox