Received: by 10.192.165.156 with SMTP id m28csp56348imm; Tue, 10 Apr 2018 16:17:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx49OVAxo12pQi3kECgnQdCUXJEP25hqZQqK970ym9R7aBXVSgxZ4px17+vUxIKaXoY8b0xUd X-Received: by 2002:a17:902:96a:: with SMTP id 97-v6mr2404977plm.266.1523402277558; Tue, 10 Apr 2018 16:17:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523402277; cv=none; d=google.com; s=arc-20160816; b=L00uvbvn7MkEv6YZ/dhuzGWWkwVTnoEE5UBLx9B2PajNzfy0v/c2dh5OX/WDEwLE/r 6NSKGduJXWZ4edJ7FDZxoEfpDnFPQAIK//8QeQlTBlO4T0Ifxr8cseHRX1dp7+48eRGt Ip9iY4JOHh+denHkR20dF2lQITszkPx0RiTZ2fuqMUidAj8zqX2ypYfCP9uwyv1Tsw4s tbTvLRS4+WOmMyHAFGuQnRGKqiLwEJ5I1qi5JQ2MNy+6Opt08yAlqBKRtYzCB3esyL/v xgibaiF5vkzukixAhgnGaWf5XaM4gM6Jm+92IjyDPBesbMAeAo9wbmubiYu/IevIZ07T l1Bw== 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=FnyKyu5V51PbqGPyV34n3ybo6CIt8s01siVtJ3FNHE0=; b=yhMG0GC2fYAUHIsIYTXsNRMVy2ikFeLTbxVtJAe+ECqEUhnxEKY0XSLbl9Px1CxTir ciFbsgCmXhbutS1X0Lud9bSTFTc5XsHvQ1mPcTeB0PTCkrKJ6eEatQ1N6Bj57gN0qkOh uRtTP6KmHHAfRdRCzqLK+lV+1NDbxDLMlPB6ZWNDkgCYaG2XdvexKORvz44R1vb3vJC2 At+yE7tCaPT6uArDWnGvSumFVak60DL/OEUPnt70/LivDilzz4za0/qKHzmyX0c9Neys S/cNw0eO/LW3p5yISEmMhjlL+GgTKXjivOQE/OCq60RJhYWOh8qpXvy6izN0COeFftkO T/Bg== 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 z11si2893747pfi.406.2018.04.10.16.17.20; Tue, 10 Apr 2018 16:17:57 -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 S932081AbeDJWdA (ORCPT + 99 others); Tue, 10 Apr 2018 18:33:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41126 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752894AbeDJWc5 (ORCPT ); Tue, 10 Apr 2018 18:32:57 -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 04C2FC64; Tue, 10 Apr 2018 22:32:56 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xin Long , Nikolay Aleksandrov , Andy Gospodarek , "David S. Miller" Subject: [PATCH 4.15 140/168] bonding: fix the err path for dev hwaddr sync in bond_enslave Date: Wed, 11 Apr 2018 00:24:42 +0200 Message-Id: <20180410212807.037974125@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@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.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xin Long [ Upstream commit 5c78f6bfae2b10ff70e21d343e64584ea6280c26 ] 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 Signed-off-by: Greg Kroah-Hartman --- 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 @@ -1565,7 +1565,7 @@ int bond_enslave(struct net_device *bond if (res) { netdev_err(bond_dev, "Couldn't add bond vlan ids to %s\n", slave_dev->name); - goto err_close; + goto err_hwaddr_unsync; } prev_slave = bond_last_slave(bond); @@ -1755,9 +1755,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 (rcu_access_pointer(bond->primary_slave) == new_slave) RCU_INIT_POINTER(bond->primary_slave, NULL); @@ -1771,6 +1768,10 @@ err_detach: synchronize_rcu(); 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);