Thread (2 messages) flat view 2 messages, 2 authors, 2021-06-07

Re: [PATCH] vlan: Avoid crashing the kernel

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2021-06-07 15:33:34
Also in: lkml

On Sun,  6 Jun 2021 20:08:39 -0700
13145886936@163.com wrote:
quoted hunk ↗ jump to hunk
From: gushengxian <redacted>

Avoid crashing the kernel, try using WARN_ON & recovery code
rather than BUG() or BUG_ON().

Signed-off-by: gushengxian <redacted>
---
 net/8021q/vlan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 4cdf8416869d..6e784fd8795b 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -97,7 +97,7 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head)
 	ASSERT_RTNL();
 
 	vlan_info = rtnl_dereference(real_dev->vlan_info);
-	BUG_ON(!vlan_info);
+	WARN_ON(!vlan_info);
 
 	grp = &vlan_info->grp;
NACK

You change turns bug on into warning and crash from null pointer dereference.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help