* [PATCH] net-bridge: fix unsafe dereference of potential null ptr in __vlan_del()
@ 2023-02-17 13:10 Alexander Sapozhnikov
0 siblings, 0 replies; 4+ messages in thread
From: Alexander Sapozhnikov @ 2023-02-17 13:10 UTC (permalink / raw)
To: Roopa Prabhu
Cc: Alexander Sapozhnikov, Nikolay Aleksandrov, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, bridge, netdev,
linux-kernel, lvc-project
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Alexander Sapozhnikov <alsp705@gmail.com>
---
net/bridge/br_vlan.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index bc75fa1e4666..87091e270adf 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -417,7 +417,8 @@ static int __vlan_del(struct net_bridge_vlan *v)
rhashtable_remove_fast(&vg->vlan_hash, &v->vnode,
br_vlan_rht_params);
__vlan_del_list(v);
- nbp_vlan_set_vlan_dev_state(p, v->vid);
+ if (p)
+ nbp_vlan_set_vlan_dev_state(p, v->vid);
br_multicast_toggle_one_vlan(v, false);
br_multicast_port_ctx_deinit(&v->port_mcast_ctx);
call_rcu(&v->rcu, nbp_vlan_rcu_free);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] net-bridge: fix unsafe dereference of potential null ptr in __vlan_del()
@ 2023-02-17 13:16 Alexander Sapozhnikov
2023-02-17 13:46 ` Alexander Lobakin
2023-02-17 13:53 ` Nikolay Aleksandrov
0 siblings, 2 replies; 4+ messages in thread
From: Alexander Sapozhnikov @ 2023-02-17 13:16 UTC (permalink / raw)
To: Roopa Prabhu
Cc: Alexander Sapozhnikov, Nikolay Aleksandrov, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, bridge, netdev,
linux-kernel, lvc-project
After having been compared to NULL value at br_vlan.c:399,
pointer 'p' is passed as 1st parameter in call to function
'nbp_vlan_set_vlan_dev_state' at br_vlan.c:420,
where it is dereferenced at br_vlan.c:1722.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Alexander Sapozhnikov <alsp705@gmail.com>
---
net/bridge/br_vlan.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index bc75fa1e4666..87091e270adf 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -417,7 +417,8 @@ static int __vlan_del(struct net_bridge_vlan *v)
rhashtable_remove_fast(&vg->vlan_hash, &v->vnode,
br_vlan_rht_params);
__vlan_del_list(v);
- nbp_vlan_set_vlan_dev_state(p, v->vid);
+ if (p)
+ nbp_vlan_set_vlan_dev_state(p, v->vid);
br_multicast_toggle_one_vlan(v, false);
br_multicast_port_ctx_deinit(&v->port_mcast_ctx);
call_rcu(&v->rcu, nbp_vlan_rcu_free);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net-bridge: fix unsafe dereference of potential null ptr in __vlan_del()
2023-02-17 13:16 Alexander Sapozhnikov
@ 2023-02-17 13:46 ` Alexander Lobakin
2023-02-17 13:53 ` Nikolay Aleksandrov
1 sibling, 0 replies; 4+ messages in thread
From: Alexander Lobakin @ 2023-02-17 13:46 UTC (permalink / raw)
To: Alexander Sapozhnikov
Cc: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, bridge, netdev, linux-kernel,
lvc-project
From: Alexander Sapozhnikov <alsp705@gmail.com>
Date: Fri, 17 Feb 2023 16:16:57 +0300
> [PATCH] net-bridge: fix unsafe dereference of potential null ptr in
> __vlan_del()
Must be:
[PATCH net] net: bridge: fix unsafe dereference of potential null ptr in
__vlan_del()
> After having been compared to NULL value at br_vlan.c:399,
> pointer 'p' is passed as 1st parameter in call to function
> 'nbp_vlan_set_vlan_dev_state' at br_vlan.c:420,
> where it is dereferenced at br_vlan.c:1722.
Do you have a reproducer for this or it's purely hypothetical? I'm not
saying it's strongly required, at least I wouldn't require it, just
curious. And sometimes without a stable repro you should target
net-next, not net, but better ask the bridge maintainers re this.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
Here you should have a "Fixes:" tag with a reference to the commit which
introduced this nullptr-deref.
> Signed-off-by: Alexander Sapozhnikov <alsp705@gmail.com>
You have 2 copies of this patch in the list. The first one lacks proper
commit message, this one has it. But you didn't marked this resent as v2
(it's v2 in fact).
Please mark it accordingly next spin and don't forget always provide a
changelog between versions.
> ---
> net/bridge/br_vlan.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
> index bc75fa1e4666..87091e270adf 100644
> --- a/net/bridge/br_vlan.c
> +++ b/net/bridge/br_vlan.c
> @@ -417,7 +417,8 @@ static int __vlan_del(struct net_bridge_vlan *v)
> rhashtable_remove_fast(&vg->vlan_hash, &v->vnode,
> br_vlan_rht_params);
> __vlan_del_list(v);
> - nbp_vlan_set_vlan_dev_state(p, v->vid);
> + if (p)
> + nbp_vlan_set_vlan_dev_state(p, v->vid);
> br_multicast_toggle_one_vlan(v, false);
> br_multicast_port_ctx_deinit(&v->port_mcast_ctx);
> call_rcu(&v->rcu, nbp_vlan_rcu_free);
Thanks,
Olek
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net-bridge: fix unsafe dereference of potential null ptr in __vlan_del()
2023-02-17 13:16 Alexander Sapozhnikov
2023-02-17 13:46 ` Alexander Lobakin
@ 2023-02-17 13:53 ` Nikolay Aleksandrov
1 sibling, 0 replies; 4+ messages in thread
From: Nikolay Aleksandrov @ 2023-02-17 13:53 UTC (permalink / raw)
To: Alexander Sapozhnikov, Roopa Prabhu
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
bridge, netdev, linux-kernel, lvc-project
On 17/02/2023 15:16, Alexander Sapozhnikov wrote:
> After having been compared to NULL value at br_vlan.c:399,
> pointer 'p' is passed as 1st parameter in call to function
> 'nbp_vlan_set_vlan_dev_state' at br_vlan.c:420,
> where it is dereferenced at br_vlan.c:1722.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Alexander Sapozhnikov <alsp705@gmail.com>
> ---
> net/bridge/br_vlan.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
> index bc75fa1e4666..87091e270adf 100644
> --- a/net/bridge/br_vlan.c
> +++ b/net/bridge/br_vlan.c
> @@ -417,7 +417,8 @@ static int __vlan_del(struct net_bridge_vlan *v)
> rhashtable_remove_fast(&vg->vlan_hash, &v->vnode,
> br_vlan_rht_params);
> __vlan_del_list(v);
> - nbp_vlan_set_vlan_dev_state(p, v->vid);
> + if (p)
> + nbp_vlan_set_vlan_dev_state(p, v->vid);
> br_multicast_toggle_one_vlan(v, false);
> br_multicast_port_ctx_deinit(&v->port_mcast_ctx);
> call_rcu(&v->rcu, nbp_vlan_rcu_free);
This cannot happen, read the code more carefully.
If you have a trace or have hit a bug, please provide the log.
Thanks,
Nacked-by: Nikolay Aleksandrov <razor@blackwall.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-17 13:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-17 13:10 [PATCH] net-bridge: fix unsafe dereference of potential null ptr in __vlan_del() Alexander Sapozhnikov
-- strict thread matches above, loose matches on Subject: below --
2023-02-17 13:16 Alexander Sapozhnikov
2023-02-17 13:46 ` Alexander Lobakin
2023-02-17 13:53 ` Nikolay Aleksandrov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).