Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2221507imm; Thu, 7 Jun 2018 07:17:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJVURWppcFQovJQG68nrhRiSpn4qMO0cVZjoEdAwMCF1K6CJscUvNZdyDcBx7DvZlgRYerZ X-Received: by 2002:a17:902:981:: with SMTP id 1-v6mr2258078pln.11.1528381032698; Thu, 07 Jun 2018 07:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528381032; cv=none; d=google.com; s=arc-20160816; b=RCGo8+HOu3KkxgZdSvlCzkL5Nf8JnyHNAWOIrCwDmBP6E030NSQI7VPQveA3J/fcuY JJQV+t2ok5BW8Safe4oA1fqdb3PF+Gco/XjGt1pY2TDh1hdXxZjeTf1T05zkcH2YWfPP ERNupi7m/n3ITaHqx6Q9LdpD8l2ssRROpNjNJKPCBK9kk38XRJRcIJUrWCXl6XzHmzBF KIz2qmZd/Mi3GuSWfp8voeYrWZpVS6ggylUQuCz9sA2oyUbXHCuBfjTGlCUBQEwRnpLT AZiZrvllcir+3oMTmMwFU8XfWK5AcHliuLZaIx8oVbEyFCpM/rgz8RE0z0YSra8IcA5p T6TA== 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=1/xa8sLZmQbXMj5UxEovqVZgKDsHmeAfcoQ9NG+PJs0=; b=QMCMArDPLvAXykgRIOWeLg5JicD0A0Wek4ghzLNJpjAGgltBQ6v9A31Sg6Z6b8FXP7 TzqkEKu4PwnlpAGOlmNdQ2UN76/8+ELthVNttSlOOXAmyq8u88JKlbTpVFNUbvcvZz0f CZZWBoPIwkOCOJ6u9hrE1NqRT3XrGHl5f9U1ErAoKXWhx25hyJi1c2+i/mKQ6JRz4uI0 LxnBJjapXyecWMt2IOY4ZGLqVBbuTw8xRhSDI6kkbPKC7LrugA5hLsqYpUIPHeM7SrxO rxeBrmovdDlgLBXKwBuxbDKf/X1U0GhLAIJXjKAtb6mbOM6PU4ZdY3pisubKK7EOmIj5 /8dg== 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 k79-v6si2691252pfb.34.2018.06.07.07.16.58; Thu, 07 Jun 2018 07:17:12 -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 S933172AbeFGONx (ORCPT + 99 others); Thu, 7 Jun 2018 10:13:53 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:39509 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933161AbeFGOJj (ORCPT ); Thu, 7 Jun 2018 10:09:39 -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-0005Zv-5L; Thu, 07 Jun 2018 15:09:17 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvbF-0003JQ-BM; 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" , "Nikolay Aleksandrov" , "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 400/410] bonding: fix the err path for dev hwaddr sync 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 5c78f6bfae2b10ff70e21d343e64584ea6280c26 upstream. vlan_vids_add_by_dev is called right after dev hwaddr sync, so on the err path it should unsync dev hwaddr. Otherwise, the slave dev's hwaddr will never be unsync when this err happens. Fixes: 1ff412ad7714 ("bonding: change the bond's vlan syncing functions with the standard ones") Signed-off-by: Xin Long Reviewed-by: Nikolay Aleksandrov Acked-by: Andy Gospodarek Signed-off-by: David S. Miller [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- drivers/net/bonding/bond_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1451,7 +1451,7 @@ int bond_enslave(struct net_device *bond if (res) { pr_err("%s: Error: Couldn't add bond vlan ids to %s\n", bond_dev->name, slave_dev->name); - goto err_close; + goto err_hwaddr_unsync; } prev_slave = bond_last_slave(bond); @@ -1626,9 +1626,6 @@ err_unregister: netdev_rx_handler_unregister(slave_dev); err_detach: - if (!bond_uses_primary(bond)) - bond_hw_addr_flush(bond_dev, slave_dev); - vlan_vids_del_by_dev(slave_dev, bond_dev); if (bond->primary_slave == new_slave) bond->primary_slave = NULL; @@ -1642,6 +1639,10 @@ err_detach: } slave_disable_netpoll(new_slave); +err_hwaddr_unsync: + if (!bond_uses_primary(bond)) + bond_hw_addr_flush(bond_dev, slave_dev); + err_close: slave_dev->priv_flags &= ~IFF_BONDING; dev_close(slave_dev);