Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2484396imm; Thu, 7 Jun 2018 11:22:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIvXOYXoASaGqAH5HkpmBFu4r3TNBmJcfWpQPLfr0ahRnu1RJfJCCjAuZPonAPrvynzwyQl X-Received: by 2002:a17:902:3343:: with SMTP id a61-v6mr3072864plc.241.1528395737531; Thu, 07 Jun 2018 11:22:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528395737; cv=none; d=google.com; s=arc-20160816; b=HXAv/CQdF1D67fZBO6W8x6JVHi1vzLfwNc/J+xSSx1gY8w9uT61duaI5z8bLlS7PHt glnqQ6OeOje4eKAV+TfdnCm200F6T4gSkjjQN+S8vetuUEUZaxDiR3pSxpbvEc+8+xvo HldC9siAkJZgnjYBWccumt+FcWArXqWL9SzMG4Mo2+OQYEUlHxi39pBCtohjiE0Wrkdq obRqZojBSg+5ydWSo7d3W6cl2koxDjNhGpVmT1Qf8NdoRuBtPfBu2QZejQg8zJ0Lh72n TongeVy3Z8wmTKz6OYnB5dXvvD5hGCPM9zWYgez+eid0qN9zdfv21HBsEin02Q1Wx/Xd pvmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=0EJU2CA4yWYzL0wXPZrtmc4n48O5c/xmGiD4FK4/YCw=; b=mXQXmGpryKT5W/tLn05stxdeyhsbibYy0ZP4q5yq810pCotIoVmAYc02QK3wN5PC7h eCzQfCEnQbnxiVTOu4Hqyayr5EgeV/4qME0mMXmYj3LAH0hGeiipfQnNSdYE1Da9mIvz WJf1kwSOcT+Ilc+9FsmwiYAxFFE29BWhcBICSg7XHs8rEpk+cXeQN11IyXHQEGUPUGvx urynF+nrgTYbukswyDQi9H9TcU0Ec0EqJVT2PiNPCTjGbVB+1feKbMPIJvTFlBPAwO1l EtNqk+3yZZwKgpdC55UyqJwecG8cc3Z58UWfrmm/VBs3QM2E5YBwE0ey6H0Av12IrmLA WroA== 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 w4-v6si48779465plz.506.2018.06.07.11.22.03; Thu, 07 Jun 2018 11:22:17 -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 S964991AbeFGPC7 (ORCPT + 99 others); Thu, 7 Jun 2018 11:02:59 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:41463 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964982AbeFGPCy (ORCPT ); Thu, 7 Jun 2018 11:02:54 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbJ-0005Zj-5f; Thu, 07 Jun 2018 15:09:17 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvbF-0003Jb-Ez; Thu, 07 Jun 2018 15:09:13 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "David S. Miller" , "Xin Long" , "Andy Gospodarek" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 402/410] bonding: process the err returned by dev_set_allmulti properly in bond_enslave In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Xin Long commit 9f5a90c107741b864398f4ac0014711a8c1d8474 upstream. 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: Ben Hutchings --- 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 @@ -1579,8 +1579,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);