Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp203939pxu; Fri, 4 Dec 2020 00:50:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzYbndiB15T6Ag4Y6nJh/27VGVnI08LmaFm2jSLpuuRO+33g1wnE80HOfV6QkecbAbmBXp8 X-Received: by 2002:a17:906:1542:: with SMTP id c2mr5956989ejd.382.1607071835198; Fri, 04 Dec 2020 00:50:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607071835; cv=none; d=google.com; s=arc-20160816; b=VMC79kGL29Y2kVS17YvEFXg4i9Xt2olbHY/LvJ7vHlxpQN3bV7Ja2bFtSVgoFfoPxN tXRuOZuOgrYWbUC0vcdylKvpSrpZwcgGW+x5lU8JRgRjxoFaNca0U5Mq4tQzVsN3OjlK XBynUQpyCs83ZBlH17ODFN5gPhTG6HWXswUtAR1nmcVTWGVxtGEekHUkGuwhsWuABUtD XMQ/bHFiYgqzXevwCN5zq2F9B21rZnuMV0idUtwCgEJ+DfY+3A9RWjPfdP6qjI5xA3eb Ag8luWcVfYlVnuC2EkumLKfiJgGigiEGa8kp6Lt3dutVS9jKRRyk8TwNA2j6bFTgCLUM 7Ddw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=xuLTCTFuWrPAcptsYbmAq49S702EoK5K8gX5OPXXmi0=; b=qm57IlElttN1REjO3ruQw8JEToliLeghbCebvxfWjmCIyWpfGyLxNYo8So+1WZvW1N HtAssTOXkGrXMKuAAEzhON2mtc5bV34xo6z8FlZ484QtOmoaOba2WwRlnP4pk4kJE/SR JHxBzyRmCQHPo/X/uSOFLafIbNNb+yctYw2CKCT6Wyn4gqJMB6fD+Qsgx79NnhBsF+oT nOiuEuMcbIl2M2Uo1GUGGU1CREfr4xKE65rs1I7AzIW2m/VHVAob4ZAkJS7U98/EktyC 4OwrQePi/Q7ZlQeG1PsmEInZ3ts3cyXW3VojMYvtgWRtd/YFJpnJfOIXuQ3Tr2P26DG+ SwUQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h17si965391ejc.592.2020.12.04.00.50.12; Fri, 04 Dec 2020 00:50:35 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729239AbgLDIqH (ORCPT + 99 others); Fri, 4 Dec 2020 03:46:07 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:9013 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725866AbgLDIqH (ORCPT ); Fri, 4 Dec 2020 03:46:07 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CnR9452ZRzhmN3; Fri, 4 Dec 2020 16:44:56 +0800 (CST) Received: from compute.localdomain (10.175.112.70) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server (TLS) id 14.3.487.0; Fri, 4 Dec 2020 16:45:16 +0800 From: Zhang Changzhong To: Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" , Jakub Kicinski CC: Zhang Changzhong , , Subject: [PATCH net] net: bridge: vlan: fix error return code in __vlan_add() Date: Fri, 4 Dec 2020 16:48:56 +0800 Message-ID: <1607071737-33875-1-git-send-email-zhangchangzhong@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.112.70] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: f8ed289fab84 ("bridge: vlan: use br_vlan_(get|put)_master to deal with refcounts") Reported-by: Hulk Robot Signed-off-by: Zhang Changzhong --- net/bridge/br_vlan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index 3e493eb..08c7741 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -266,8 +266,10 @@ static int __vlan_add(struct net_bridge_vlan *v, u16 flags, } masterv = br_vlan_get_master(br, v->vid, extack); - if (!masterv) + if (!masterv) { + err = -ENOMEM; goto out_filt; + } v->brvlan = masterv; if (br_opt_get(br, BROPT_VLAN_STATS_PER_PORT)) { v->stats = netdev_alloc_pcpu_stats(struct br_vlan_stats); -- 2.9.5