lkml.org 
[lkml]   [2022]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1] net/8021q/vlan: check the return value of vlan_vid_add()
Date
Check the return value of vlan_vid_add() which could fail and return
error code.

Signed-off-by: Li Zhong <floridsleeves@gmail.com>
---
net/8021q/vlan.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index e40aa3e3641c..e96aefd00a6e 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -382,7 +382,10 @@ 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);
+ int 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))
--
2.25.1
\
 
 \ /
  Last update: 2022-09-19 09:46    [W:0.075 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site