linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vlan: Avoid crashing the kernel
@ 2021-06-07  3:08 13145886936
  2021-06-07 15:33 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: 13145886936 @ 2021-06-07  3:08 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, gushengxian

From: gushengxian <gushengxian@yulong.com>

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

Signed-off-by: gushengxian <gushengxian@yulong.com>
---
 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;
 
@@ -163,7 +163,7 @@ int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack)
 
 	vlan_info = rtnl_dereference(real_dev->vlan_info);
 	/* vlan_info should be there now. vlan_vid_add took care of it */
-	BUG_ON(!vlan_info);
+	WARN_ON(!vlan_info);
 
 	grp = &vlan_info->grp;
 	if (grp->nr_vlan_devs == 0) {
-- 
2.25.1



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

* Re: [PATCH] vlan: Avoid crashing the kernel
  2021-06-07  3:08 [PATCH] vlan: Avoid crashing the kernel 13145886936
@ 2021-06-07 15:33 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2021-06-07 15:33 UTC (permalink / raw)
  To: 13145886936; +Cc: davem, kuba, netdev, linux-kernel, gushengxian

On Sun,  6 Jun 2021 20:08:39 -0700
13145886936@163.com wrote:

> From: gushengxian <gushengxian@yulong.com>
> 
> Avoid crashing the kernel, try using WARN_ON & recovery code
> rather than BUG() or BUG_ON().
> 
> Signed-off-by: gushengxian <gushengxian@yulong.com>
> ---
>  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.

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

end of thread, other threads:[~2021-06-07 15:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-07  3:08 [PATCH] vlan: Avoid crashing the kernel 13145886936
2021-06-07 15:33 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).