From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Gospodarek Subject: Re: [PATCH net 3/3] bonding: process the err returned by dev_set_allmulti properly in bond_enslave Date: Mon, 26 Mar 2018 12:07:19 -0400 Message-ID: <20180326160719.GC92743@C02RW35GFVH8> References: <5695ce418ff6d7a2755053d6c7c35dfd3ebf2d6b.1521997984.git.lucien.xin@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: network dev , davem@davemloft.net, Jiri Pirko , Wang Chen , Veaceslav Falico , Nikolay Aleksandrov To: Xin Long Return-path: Received: from mail-wm0-f67.google.com ([74.125.82.67]:55151 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751249AbeCZQH3 (ORCPT ); Mon, 26 Mar 2018 12:07:29 -0400 Received: by mail-wm0-f67.google.com with SMTP id h76so16460333wme.4 for ; Mon, 26 Mar 2018 09:07:29 -0700 (PDT) Content-Disposition: inline In-Reply-To: <5695ce418ff6d7a2755053d6c7c35dfd3ebf2d6b.1521997984.git.lucien.xin@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, Mar 26, 2018 at 01:16:47AM +0800, Xin Long wrote: > 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 Acked-by: Andy Gospodarek > --- > 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);