Received: by 10.192.165.156 with SMTP id m28csp29896imm; Tue, 10 Apr 2018 15:44:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx49Gd3fMRtoMjx7Iypg7WVf4EiHTCD+3yAkh1xwITV4bLH+aWDZNR4aacaPgQfWuFZr3UZD1 X-Received: by 2002:a17:902:581e:: with SMTP id m30-v6mr2355544pli.406.1523400276661; Tue, 10 Apr 2018 15:44:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523400276; cv=none; d=google.com; s=arc-20160816; b=Hpz8dp6X27ZpgW6jLoWac7qKSr88xBBo9z6cXtIdPAerRZGzhCZNUj6SPy12ia1wN4 tVU0qRz/rg56hnjNhlo22PIMqEwaImv9pgGT2mnJAjv8btmFLQGXVpkd2EIrzR4nX67X 5Fzce3osc5TKikCmFwdFr1Ov6vcCVzoB+WA9SqU3r3Zk9mT2Ns5u9IVu250adt288rOX Gpjz73Jk2sxRT3aYRupEr3rCCmdsPtP/+wPm0hcTedARxDQnRqrfuUlSFntmaFwA+0lM qcYJsFCJB/Y6lB7TqxMFbN0pozRD6Ey3zibKW+Rd7/pDOBtsJEpUiT6h1OjYxGIm0TMY 0lXw== 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=hMYcCPp36PKOUliUrs6eZTaSdkqbZKothgriKS+iu3I=; b=cAKPH/SDICJD73jonx3pgD7mYUxzODm/sQxmdsJXM0B5z8L+1CxUYuJr3e7rLYXi3b sBlrsSHM1vuLDx5ABInyaisz+EUl3kcfdpPxDVZHwGt0C/ZFb5U3y7yYKz3Q4lwHkxxm veQJFdpwj8ieD+sbIvNaGNgl7YyqOhQQkgGs9yT3DlEotR6QZDau2bm5Q4Pmo74I8Vfs DHMG/JD5OOiFiTpOR0EqEfRl5lk9AOC2y1zUJdoQi1PvUvSKi2AeYhXTO0Uy/RP8av2Y WF7o5JgScxUhFkJI6gDo+En3DAxHmBMqTQmgmh7dPLobLASFhYCbOmkuCtIkNpWog5qV s6yA== 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 m37-v6si3546543pla.346.2018.04.10.15.44.00; Tue, 10 Apr 2018 15:44:36 -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 S932676AbeDJWj5 (ORCPT + 99 others); Tue, 10 Apr 2018 18:39:57 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45940 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932225AbeDJWju (ORCPT ); Tue, 10 Apr 2018 18:39:50 -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 11E3CDC9; Tue, 10 Apr 2018 22:39:44 +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.14 114/138] bonding: fix the err path for dev hwaddr sync in bond_enslave Date: Wed, 11 Apr 2018 00:25:04 +0200 Message-Id: <20180410212915.415796991@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 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 @@ -1561,7 +1561,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); @@ -1751,9 +1751,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); @@ -1767,6 +1764,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);