mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] net/8021q/vlan: check the return value of vlan_vid_add()
@ 2022-09-19  7:46 Li Zhong
  2022-09-19 12:12 ` kernel test robot
  2022-09-19 15:20 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Li Zhong @ 2022-09-19  7:46 UTC (permalink / raw)
  To: linux-kernel, netdev
  Cc: jgg, william.xuanziyang, pabeni, kuba, edumazet, davem, Li Zhong

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-19 15:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19  7:46 [PATCH v1] net/8021q/vlan: check the return value of vlan_vid_add() Li Zhong
2022-09-19 12:12 ` kernel test robot
2022-09-19 15:20 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®