summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorRundong Ge <rdong.ge@gmail.com>2019-02-02 14:29:35 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-12 19:47:22 +0100
commit8104a5e73f1f562fca5d73b1e3831de8d8979c80 (patch)
tree87372cce4fd5cdaa575f961e158bbf01e5d08904 /net
parent27a2fa0098171199022affa76bdf15d77585457f (diff)
downloadlinux-stable-8104a5e73f1f562fca5d73b1e3831de8d8979c80.tar.gz
linux-stable-8104a5e73f1f562fca5d73b1e3831de8d8979c80.tar.bz2
linux-stable-8104a5e73f1f562fca5d73b1e3831de8d8979c80.zip
net: dsa: slave: Don't propagate flag changes on down slave interfaces
[ 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 <rdong.ge@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/dsa/slave.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index ae4de876197d..b39720d0995d 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -140,11 +140,14 @@ static int dsa_slave_close(struct net_device *dev)
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)