From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xin Long Subject: [PATCH net 3/3] bonding: process the err returned by dev_set_allmulti properly in bond_enslave Date: Mon, 26 Mar 2018 01:16:47 +0800 Message-ID: <5695ce418ff6d7a2755053d6c7c35dfd3ebf2d6b.1521997984.git.lucien.xin@gmail.com> References: <8fd918da5a08f64dd69a45bcda3849bbd8114267.1521997984.git.lucien.xin@gmail.com> Cc: davem@davemloft.net, Jiri Pirko , Wang Chen , Veaceslav Falico , Nikolay Aleksandrov To: network dev Return-path: Received: from mail-pl0-f67.google.com ([209.85.160.67]:43598 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751597AbeCYRRT (ORCPT ); Sun, 25 Mar 2018 13:17:19 -0400 Received: by mail-pl0-f67.google.com with SMTP id f23-v6so10489122plr.10 for ; Sun, 25 Mar 2018 10:17:19 -0700 (PDT) In-Reply-To: In-Reply-To: References: Sender: netdev-owner@vger.kernel.org List-ID: When dev_set_promiscuity(1) succeeds but dev_set_allmulti(1) fails, dev_set_promiscuity(-1) should be done before going to the err path. Otherwise, dev->promiscuity will leak. Fixes: 7e1a1ac1fbaa ("bonding: Check return of dev_set_promiscuity/allmulti") Signed-off-by: Xin Long --- drivers/net/bonding/bond_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 55e1985..b7b1130 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1706,8 +1706,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, /* set allmulti level to new slave */ if (bond_dev->flags & IFF_ALLMULTI) { res = dev_set_allmulti(slave_dev, 1); - if (res) + if (res) { + if (bond_dev->flags & IFF_PROMISC) + dev_set_promiscuity(slave_dev, -1); goto err_sysfs_del; + } } netif_addr_lock_bh(bond_dev); -- 2.1.0