Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2749210imj; Mon, 11 Feb 2019 07:56:10 -0800 (PST) X-Google-Smtp-Source: AHgI3IZttErmgAVMPOkJD6txMrz8shwZwuIUooFFlCrgD+CR+sH7AccHAP2+OLtwhLPulJ03Nr1o X-Received: by 2002:a17:902:848f:: with SMTP id c15mr36977365plo.119.1549900570144; Mon, 11 Feb 2019 07:56:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549900570; cv=none; d=google.com; s=arc-20160816; b=BwfRLDOypKgPd8/Cc7Koqbx9KvOIO8MyzMCX71bTSs6dY+k/QiRXEmJcbFfhJGs6LL oMV/A82tyoN1fNzqo6wOwcuyOKKzAYeFAy5W9nEumfK9ECNT3zCVenyxdVgv8wqfOxX1 wm62hUC0RIARw8Q/UtlG+tYHo+GD7mb+DjCZvUdr/6u+3Ba3cIosomOpGw9iJQ5lShWC 5G6XfRsLwRQE8EoFCUJq+K8ayPwO9DxKzOLcsBijv88shYpPQSlOkGglqvoerKPjNcF2 OKDU42PxJwxKlmf7YoFdfZylSk18r3bM5ilVLI3IRd1gbkMfdnwuPKBLvt/bdrFVzry2 wkbw== 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=HF+WARr/K+zQbrRwRk3HZbADffpg8MfDHncjRmCaHHA=; b=jmeum0EhrSOnJ5RjrNKkyQ4/rKW/s2NfMxWvk3WO05rgjDRBr2jfyHy0k1Ca3jpQef /ttVtbrCUJrRbfvV0SEIw92yRPuYULxk+OH1NYij0CgmtpgkLj5eJpk0hK6F1V716O6P QP2Ju2tzylP/gozSqvnwBYp3RCeh8uAYyluWFSv3sYIxUXSF8njVw6sdvXdj/nzC2Yi9 38BTsyFOVpXWXXVJ3iHMmKceJlc8Z7/DbazyRbRzWOo6sOGBHjYt4Cr/jY9YpO8J7p3A RXa1JqFpMH/m2ikPQ4HT5sl09mSQDId4n15wY6zdbRaq/ZMiCzF0/xtsSGdp5hzSj+eD nABw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0X6NzZnQ; 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 p14si6128465pfi.12.2019.02.11.07.55.53; Mon, 11 Feb 2019 07:56:10 -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=0X6NzZnQ; 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 S1731020AbfBKOf0 (ORCPT + 99 others); Mon, 11 Feb 2019 09:35:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:43908 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730434AbfBKOfR (ORCPT ); Mon, 11 Feb 2019 09:35:17 -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 C699F204EC; Mon, 11 Feb 2019 14:35:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895717; bh=1bpTAvtInffAGMrfRbwkwZB1SlXyrwFD3ojN2JkfZV4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0X6NzZnQd8Df8GMC9F0zZJul0Cr5KZxbH3TkF0W5WMn+JX0PUJSb4hHWnXmRK1zXd lhRxPZrJIScz56vighYIDflJZ8M1JjNPbBzA2p8biXQ3shATdQ+DUJwZLAmoNm/vxF R+FgklD2v6C4WYvj83CHRRQAPd7xQMjOS8ilmRW0= 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.20 299/352] net: dsa: slave: Dont propagate flag changes on down slave interfaces Date: Mon, 11 Feb 2019 15:18:46 +0100 Message-Id: <20190211141905.895692087@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@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.20-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 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -140,11 +140,14 @@ static int dsa_slave_close(struct net_de static void dsa_slave_change_rx_flags(struct net_device *dev, int change) { struct net_device *master = dsa_slave_to_master(dev); - - 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)