netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: 13145886936@163.com
Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	gushengxian <gushengxian@yulong.com>
Subject: Re: [PATCH] vlan: Avoid crashing the kernel
Date: Mon, 7 Jun 2021 08:33:25 -0700	[thread overview]
Message-ID: <20210607083325.1a68e8e6@hermes.local> (raw)
In-Reply-To: <20210607030839.374323-1-13145886936@163.com>

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.

      reply	other threads:[~2021-06-07 15:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07  3:08 [PATCH] vlan: Avoid crashing the kernel 13145886936
2021-06-07 15:33 ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210607083325.1a68e8e6@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=13145886936@163.com \
    --cc=davem@davemloft.net \
    --cc=gushengxian@yulong.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).