Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2937515pxj; Sun, 6 Jun 2021 20:12:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/Ova3UVQuyvrGe6AgC40ZWlX8vpXA2fJFQa2MCL68D/LpPAFe7QmAkUkRWrAPdp1yNTWl X-Received: by 2002:a05:6402:54f:: with SMTP id i15mr17618537edx.339.1623035537664; Sun, 06 Jun 2021 20:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623035537; cv=none; d=google.com; s=arc-20160816; b=O9IB0YkBiVcQXP6pDIDfUl75gjgD2wnwuKA3g3UA60TGsGMMKb6pl1Hbnbg49Oo3WS hzIZ+C9QoF3wbfsCf232ABXS8gTk/+ZzSmjGGxKqWeoTLffNr5hmmeMmVhTlLLzWVD00 F4ORMt+D9aDKv2643oIfMx02P2eZkDYZMb0t00V7x/bPJXITcoXDzXShadVruVRRQa9F BzlEIPW4C3P7n8JwP7LNhiaMhLwMrHXanX7kgDJZyLKE0WtZZWJnczf9qP+b6jPeuNto 3kINzaOeEaZi9/2l0XMKPxvpepKhbhj+D9X5XzwP/JTKymVEEhKldPLsD82/luyAKgMs SDvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=NJyv4cJvzWTV0Z6UppUARpGUFXFp+OeC5caDPgArcl4=; b=mtsXW2zSPPbrSLwMOxdYhj1/89rKKBqonFrvNoa4ETejIxJc9HhuHpDu6PgtpHg03A mOrB7H4pBe7MaZfvxlhWvuNT6n25ndZRqZ/CASg6xO1APRh5W/3s8BJ6RiesM52igMTf LFsnWJRtq8EOkQ79KpgxHP6qVPnxhSDibfNA4g+4vxkBIBsbsON51DodXmExbKsqLoth ff1azr6arNOjIpqLYwXEQOKfcRbb1vLV4F/FeiS2Ry/nJNMrRhkvmB+XmDJqRB60iSl4 hgupobS62GGULNZHcLxdu1jGoKJy93Yh76CJZZeu0d4OdP59f/KJJ7NkjMSPX6bTJBR6 6a4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b="Dm+0O/73"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e6si13628672edz.248.2021.06.06.20.11.54; Sun, 06 Jun 2021 20:12:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b="Dm+0O/73"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230193AbhFGDKr (ORCPT + 99 others); Sun, 6 Jun 2021 23:10:47 -0400 Received: from m12-18.163.com ([220.181.12.18]:33842 "EHLO m12-18.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230127AbhFGDKq (ORCPT ); Sun, 6 Jun 2021 23:10:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=NJyv4 cJvzWTV0Z6UppUARpGUFXFp+OeC5caDPgArcl4=; b=Dm+0O/73UR+TxReruze0h 2Ptm/HOqAB637CF7sIZB72cy/QAlfk8TDBd2e/kzzKeOkUXSB9mKRQIJ+D7OVHQ2 FUGbc/hxaStqTQHrKvBeK4yqKjhNm7WBqNPUXqDu+ckyZCqMbRaQQ70DcsEZiLMA ekMjmXeeaTH9v6TLPtNAEo= Received: from ubuntu.localdomain (unknown [218.17.89.92]) by smtp14 (Coremail) with SMTP id EsCowAB3feW7jb1gKwrcnw--.39184S2; Mon, 07 Jun 2021 11:08:44 +0800 (CST) From: 13145886936@163.com To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, gushengxian Subject: [PATCH] vlan: Avoid crashing the kernel Date: Sun, 6 Jun 2021 20:08:39 -0700 Message-Id: <20210607030839.374323-1-13145886936@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: EsCowAB3feW7jb1gKwrcnw--.39184S2 X-Coremail-Antispam: 1Uf129KBjvdXoWruF1kZF15Zw18urW8KF17KFg_yoWDArg_W3 97Kr1UKw4DAan2yw45W3yIvr9rAw109r4xX3WxArW7try8ArZ0kr18Z3W3Jr1a9rW8ur9r GFn2vr93Cr97tjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUeGFAJUUUUU== X-Originating-IP: [218.17.89.92] X-CM-SenderInfo: 5zrdx5xxdq6xppld0qqrwthudrp/1tbiQhyqg1aD-Kmt2QAAsD Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: gushengxian Avoid crashing the kernel, try using WARN_ON & recovery code rather than BUG() or BUG_ON(). Signed-off-by: gushengxian --- 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