Received: by 10.192.165.156 with SMTP id m28csp1089064imm; Wed, 11 Apr 2018 12:11:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+ipusIqNHJ8Kkmr911k0+qx381oNAkxccwq883V/wMijd4BCHYd628/bpMmVUgJG6sHCuy X-Received: by 2002:a17:902:96a:: with SMTP id 97-v6mr6278258plm.266.1523473911737; Wed, 11 Apr 2018 12:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523473911; cv=none; d=google.com; s=arc-20160816; b=Io/jSgkKRIQgUbF8p/soDSHv3seMvq/oDg3lHHbIzbO2RkVRj6SeCOfvl8om39yxSh pvVpM8peBp3S45B3zxY+iGFOWxtH10i+7m0w2az8I33RIg0e8+luDesPdcYYxONdi7Pv 49NmcLEElsnRxlKhAvc8V7FRayl3qDA8xYrY+09ayGqAkZ93JHGnHloUduHHplzQW4qH cFaFoRusmEr1GyWVSUDq0mddLU6T/Qr/+/fZTtt9POf7PwF3CJSVxbSygZRXPsSB9Sps iST61pCRan2xLn6hiIMwdoVnKEzjAUAvdX1ayxlhxm4cvatryWE7TDcHu87RC3gdT68q p5TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=DUvA5Cqbc5FGJTu+WS4xAIDzDLi9gEPxAYNE6jSFzPA=; b=uDGntn/qwtin+a/jX83sAcGrLL8XCigswowe2JHVNxQ+T4kDLh6zrg/YAKjKg+Q6ss mtG217a71vz2TA9hwysi8eUY94ZJDQSh2OGPXVWnrX4H89aCRYm+8N+R9FMW+AhNBBQZ owV3OgfUNdJOFH7CTldRbDxIZG5zJriaaaJUadb03nwTjUJlA9ldJr989zPk+BrgxKef jw70oQlsbLx0gkcAOPOtodzQnH/4rJSUTOQ2elFtlxDloOBfAIwxUoa+HLC5eHorAFP2 FiBxWE2Y+5ijR7Id/KYHTWOovuZKJgpn1ZPIEgxLp6AoAYl5HUlAaS24nM9mjuwXfLxE y2qg== ARC-Authentication-Results: i=1; mx.google.com; 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 34-v6si1701260plp.543.2018.04.11.12.11.15; Wed, 11 Apr 2018 12:11:51 -0700 (PDT) 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; 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 S935414AbeDKTHu (ORCPT + 99 others); Wed, 11 Apr 2018 15:07:50 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41040 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935371AbeDKTHJ (ORCPT ); Wed, 11 Apr 2018 15:07:09 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 924DBDB3; Wed, 11 Apr 2018 19:07:08 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xin Long , Andy Gospodarek , "David S. Miller" Subject: [PATCH 4.9 292/310] bonding: process the err returned by dev_set_allmulti properly in bond_enslave Date: Wed, 11 Apr 2018 20:37:11 +0200 Message-Id: <20180411183635.158546786@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xin Long [ Upstream commit 9f5a90c107741b864398f4ac0014711a8c1d8474 ] 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 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/bonding/bond_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1700,8 +1700,11 @@ int bond_enslave(struct net_device *bond /* 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);