Skip to contentSkip to conversation

net/8021q/vlan: check the return value of vlan_vid_add()

PATCH New Li Zhong 1 participant 1 message Sep 19, 2022

Subsystems (2)
lore
Share & tools
lore

Li Zhong

author
#0 lore raw

PATCH v2 1/1 net/8021q/vlan: check the return value of vlan_vid_add()

Check the return value of vlan_vid_add() which could fail and return error code.

---
 net/8021q/vlan.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/8021q/vlan.c +3 -1
index e40aa3e3641c..cb8048ce05f1 100644
@@ -382,7 +382,9 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
 	    (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) {
 		pr_info("adding VLAN 0 to HW filter on device %s\n",
 			dev->name);
-		vlan_vid_add(dev, htons(ETH_P_8021Q), 0);
+		err = vlan_vid_add(dev, htons(ETH_P_8021Q), 0);
+		if (err)
+			return notifier_from_errno(err);
 	}
 	if (event == NETDEV_DOWN &&
 	    (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
Signature · 1 line
2.25.1