Received: by 10.223.185.116 with SMTP id b49csp5488290wrg; Wed, 7 Mar 2018 12:38:50 -0800 (PST) X-Google-Smtp-Source: AG47ELtMxB7ffF7x6qarRRE8iKu8exTiy8rs7ReTBz1//uHcpeCEU9s+8e3dQ7BuhgiAb3eGD/69 X-Received: by 2002:a17:902:70cb:: with SMTP id l11-v6mr22051019plt.192.1520455130560; Wed, 07 Mar 2018 12:38:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520455130; cv=none; d=google.com; s=arc-20160816; b=jtBcGi97xGxW1xkd2c+IDq6CaTH8EsI8TG6p2zHPOPdy9LxqR4wF9IWLJbgo6wru2+ 10JnXm/bxnnWxRLbn53GJHvHZ6wKpSaBRHmJweSNDl/FKRTREBt3eAlflVUBfQojFBx+ eMAkmvY+5du9XgFB3GkK3tRsmcSkxa2xHoPiSpmcLlKaJ8IqmBX/zZBvcY0jzIEPzOrd vwF+teoEOmklxLhPSIVehLdND3beCNClkuUt/kOfItTyRINMxEH3Se6jD78NLWGyfbsb il+LvROXEe/oyIP4qq7ccSTr27LMW1T0nHLTdxmv2ueTuQRldsqPbVcp2/7S2hKUwG56 rxwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=mQkMZbNMr2JhLDpi2yT32kUFHSizTPF1gC/xXwy0qYI=; b=Qpv/AyBkjQecX3+aDtEnuj6JCq5QRMP68pBmrRC3EmWJIH8shLPOmxGTiS5TMUNbh6 06zAGagMzZ9uKXP3Ci3z43zvkSdVz718iNKpWm7NR3/REjD11QNM42dOf5cO8vecNU0E 7ptgJCHp3/ckw6tEoQ3ifZLFf2Y8wovgkH0xCmwXi5ypxh/1pdOBbcioqLiX8hZXdONV bEwi9cmUX3iCeqcdPQpYSKPYQ2EvPkQLKJ0P1I6/bevkIURqaCWKipq4VxhcTLiHmLhQ DYmH8R7s7KKFsw05vCumeGD0nZGDgTcNiRmkXLR00kmQ/jxZCW7Hk6DyV68fzLkaWTdq kfkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v27si14454034pfa.387.2018.03.07.12.38.36; Wed, 07 Mar 2018 12:38:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964862AbeCGUhn (ORCPT + 99 others); Wed, 7 Mar 2018 15:37:43 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:41630 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754852AbeCGTmB (ORCPT ); Wed, 7 Mar 2018 14:42:01 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D253BFB3; Wed, 7 Mar 2018 19:41:59 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ido Schimmel , Nikolay Aleksandrov , "David S. Miller" Subject: [PATCH 4.15 068/122] bridge: Fix VLAN reference count problem Date: Wed, 7 Mar 2018 11:38:00 -0800 Message-Id: <20180307191739.211643933@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191729.190879024@linuxfoundation.org> References: <20180307191729.190879024@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ido Schimmel [ Upstream commit 0e5a82efda872c2469c210957d7d4161ef8f4391 ] When a VLAN is added on a port, a reference is taken on the corresponding master VLAN entry. If it does not already exist, then it is created and a reference taken. However, in the second case a reference is not really taken when CONFIG_REFCOUNT_FULL is enabled as refcount_inc() is replaced by refcount_inc_not_zero(). Fix this by using refcount_set() on a newly created master VLAN entry. Fixes: 251277598596 ("net, bridge: convert net_bridge_vlan.refcnt from atomic_t to refcount_t") Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/bridge/br_vlan.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -168,6 +168,8 @@ static struct net_bridge_vlan *br_vlan_g masterv = br_vlan_find(vg, vid); if (WARN_ON(!masterv)) return NULL; + refcount_set(&masterv->refcnt, 1); + return masterv; } refcount_inc(&masterv->refcnt);