Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2716695imj; Mon, 11 Feb 2019 07:25:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IaVevPsI6xqbDvt29eA6AqjeVjMew9+J3CZcMtNv5uXYEvxgBL822y5RCNJqwWMe/UiQSN1 X-Received: by 2002:a17:902:7c82:: with SMTP id y2mr37497634pll.33.1549898751456; Mon, 11 Feb 2019 07:25:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549898751; cv=none; d=google.com; s=arc-20160816; b=jP3XRt2g0th3NnIsi6UGORMeYg0QiW3QgAWgmZcUfjIt4Lk79gxFdY52QWJbHDkxRb tw5lMqlpOcjFyhNYYnDXu2mn6LIdxpFEfXRqfJwuaqVA1ys1E+EwKsxgDmYxit0DwKC4 4RNpfwy16JX6T8kVPGEV14ZRXtqhc/O362ICwctVhMcTM2E9k6S6vichZygr3kTpFQUa ZuTpugZ4X2/UAQVsGDYviu0QRXGI08Tl3UlugachpSO0XVxiRWJtPrVD/bgiQb7Ojgnr kOuvhjuSwPaqhwB1idx6YPP3GwQDE9jqhnOwUgfIhYwEq3jMw/07iZXjjV1K4UKKaGSG bAOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=m1anWYqzBdzLjDotsd+dmDO+VjgM/f3RyjiIUCYpr3U=; b=ygcTq6mxd+VjNklfzy+srMXP/vqlStVWdsRg1bKCb9Ylrc0/7CxmkR/42RFMWBZzhg poB0bg0sqbhEt2/yEJKTP5chfqAPX1EIDxma11awg5JrMVZbdI2RIxzIvc6fxyFMxBWN 9YEtAkkHH2rr/IXv+mDtqNhJTbweSiwOcRpJifNyn3g5Jb5IAq1YyfK/CJkxpopWGuXb sRAmKLl8LqHFSkQmUPk26aSNI9NUaklW3Ou/F/rqZ7AUA2WyhX7CW6lk6Ef2phXhzkUt gCKAWRELnEA1le4ksjD/Vuhzyy/+6sxdLn+8vTpNB/PjysNKN+jIiVDDEZDAVJiamz1f F9Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tZCyyPoE; 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 j127si9726530pgc.444.2019.02.11.07.25.35; Mon, 11 Feb 2019 07:25:51 -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; dkim=pass header.i=@kernel.org header.s=default header.b=tZCyyPoE; 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 S2390452AbfBKPCm (ORCPT + 99 others); Mon, 11 Feb 2019 10:02:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:50800 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389716AbfBKPCe (ORCPT ); Mon, 11 Feb 2019 10:02:34 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 862E0222AE; Mon, 11 Feb 2019 15:02:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897354; bh=+0K36yVLa9erlj08K2pV0sKZ6O0g5aafC0HZ4ZSOU4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tZCyyPoEBFWA7cf2v/UOnKL6BL7p/yXmxvzZbq9LZtJSGrCLDODfPQ+C80ImRWrrq HEncQnEPbuZ09ywTIOXx4NpyxVWf+nM9TWTdkBd/wrnW80rg0XvMueTPAqvR+vnLfA jN/vWY1+AWF7UcKdvjAcesC/gpSuCZ5RGLXIuL3I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rundong Ge , "David S. Miller" Subject: [PATCH 4.14 174/205] net: dsa: slave: Dont propagate flag changes on down slave interfaces Date: Mon, 11 Feb 2019 15:19:32 +0100 Message-Id: <20190211141839.748869907@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rundong Ge [ Upstream commit 17ab4f61b8cd6f9c38e9d0b935d86d73b5d0d2b5 ] The unbalance of master's promiscuity or allmulti will happen after ifdown and ifup a slave interface which is in a bridge. When we ifdown a slave interface , both the 'dsa_slave_close' and 'dsa_slave_change_rx_flags' will clear the master's flags. The flags of master will be decrease twice. In the other hand, if we ifup the slave interface again, since the slave's flags were cleared the 'dsa_slave_open' won't set the master's flag, only 'dsa_slave_change_rx_flags' that triggered by 'br_add_if' will set the master's flags. The flags of master is increase once. Only propagating flag changes when a slave interface is up makes sure this does not happen. The 'vlan_dev_change_rx_flags' had the same problem and was fixed, and changes here follows that fix. Fixes: 91da11f870f0 ("net: Distributed Switch Architecture protocol support") Signed-off-by: Rundong Ge Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/dsa/slave.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -156,10 +156,14 @@ static void dsa_slave_change_rx_flags(st struct dsa_slave_priv *p = netdev_priv(dev); struct net_device *master = dsa_master_netdev(p); - if (change & IFF_ALLMULTI) - dev_set_allmulti(master, dev->flags & IFF_ALLMULTI ? 1 : -1); - if (change & IFF_PROMISC) - dev_set_promiscuity(master, dev->flags & IFF_PROMISC ? 1 : -1); + if (dev->flags & IFF_UP) { + if (change & IFF_ALLMULTI) + dev_set_allmulti(master, + dev->flags & IFF_ALLMULTI ? 1 : -1); + if (change & IFF_PROMISC) + dev_set_promiscuity(master, + dev->flags & IFF_PROMISC ? 1 : -1); + } } static void dsa_slave_set_rx_mode(struct net_device *dev)