Skip to contentSkip to conversation

net-bridge: fix unsafe dereference of potential null ptr in __vlan_del()

PATCH New Alexander Sapozhnikov 1 participant 1 message Feb 17, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net-bridge: fix unsafe dereference of potential null ptr in __vlan_del()

Found by Linux Verification Center (linuxtesting.org) with SVACE.

---
 net/bridge/br_vlan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/bridge/br_vlan.c +2 -1
index bc75fa1e4666..87091e270adf 100644
@@ -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);
Signature · 1 line
2.34.1