Received: by 10.192.165.156 with SMTP id m28csp36041imm; Tue, 10 Apr 2018 15:52:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx490XFRS0fSZWKFumKpGSBYafn0vZJFP2zilVn0IY395sVEBQzFjC52RhwLyx/6FMKDVJFsf X-Received: by 10.101.97.205 with SMTP id j13mr1595885pgv.266.1523400763534; Tue, 10 Apr 2018 15:52:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523400763; cv=none; d=google.com; s=arc-20160816; b=b17z0trmxNMpMJDVfN9vcuAL3hzcrkN+tL2D5p2L6zpCZCEcUv8/38vU/Sq2y9wVay c/4neLeD2ma9kvb5GXNRtxOwpkCrtmTvwLUF4tDUSZ0nP66TZpztjy4k1cHv5b8ux0OP OEfaHFGHkHl4hpAmSormTZq1PlLCId6azmlzxRMcvBvXhxLord0XMJgBYKYlaoInvFBp jzT4LRoNguOhBqGoSogJLVmeY90d9xGHNiYbe8+dAmN+Gw+urWeA51R+9SNaWH1Cfrw+ +gmBO/Q+8qmmjzMiLA7pA4BG7QwCYPdQVL8LqW7sHvcsGxS/EvN5TY6km9vkDBwkqETA AFmA== 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=lILDBbfDVBrjKdhXMw2q6l2RKpdYvxXO4+fjO8+A3eM=; b=LBqvBreIVcGBfRfx34dHehUuZ0iDw3w9YyWqWkUQ8r4bKIpbZHWZ+g0sAgMFQfPDWe F+EQRFfKmJWmWJXgsokxTIXt1m8tbVUXvM/bzTadErQ6T7DPDIfymGo1lbWt517xzSF2 OVZovHmmn2xcp/GI2IBi7flyA0i3DMcW/XPQbNqHTmMY0vpd34b6yrpXAQmqgCKrl2T8 L3+DGWBc8ER/moUFWAj6bZGGZBdwx3vhg3ERhGg5QpjZ4xu95fJ23EBD2SW8oYm1FXBL KU8KBstsrYIa8t6fUNfvqTYa14t1g1DndebFKNd509DjQvzwxvkP2TILltZ9M/FpN1v9 CF/Q== 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 z62si2794644pfb.305.2018.04.10.15.52.06; Tue, 10 Apr 2018 15:52:43 -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 S932500AbeDJWi6 (ORCPT + 99 others); Tue, 10 Apr 2018 18:38:58 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45012 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932482AbeDJWiy (ORCPT ); Tue, 10 Apr 2018 18:38:54 -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 814D4D1B; Tue, 10 Apr 2018 22:38:53 +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.14 116/138] bonding: process the err returned by dev_set_allmulti properly in bond_enslave Date: Wed, 11 Apr 2018 00:25:06 +0200 Message-Id: <20180410212915.642286449@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@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.14-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 @@ -1702,8 +1702,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);