From patchwork Thu Apr 18 14:34:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 237663 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 16E322C00AA for ; Fri, 19 Apr 2013 00:38:09 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966832Ab3DROiA (ORCPT ); Thu, 18 Apr 2013 10:38:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41975 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965340Ab3DROh6 (ORCPT ); Thu, 18 Apr 2013 10:37:58 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3IEbgQl020648 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 18 Apr 2013 10:37:42 -0400 Received: from boza.brq.redhat.com (dhcp-1-132.brq.redhat.com [10.34.1.132]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3IEbcT0002416; Thu, 18 Apr 2013 10:37:40 -0400 From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: andy@greyhouse.net, fubar@us.ibm.com, davem@davemloft.net Subject: [PATCH 1/5] bonding: mc addresses don't get deleted on enslave failure Date: Thu, 18 Apr 2013 16:34:53 +0200 Message-Id: <1366295697-31037-2-git-send-email-nikolay@redhat.com> In-Reply-To: <1366295697-31037-1-git-send-email-nikolay@redhat.com> References: <1366295697-31037-1-git-send-email-nikolay@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add dev_mc_del after err_detach as that's the first error path after they're added. The main issue is the mc addresses' refcount which only gets bumped up. Signed-off-by: Nikolay Aleksandrov --- drivers/net/bonding/bond_main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index a61a760..dc0153b 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1523,6 +1523,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) struct sockaddr addr; int link_reporting; int res = 0; + u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR; if (!bond->params.use_carrier && slave_dev->ethtool_ops->get_link == NULL && @@ -1726,12 +1727,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) netif_addr_unlock_bh(bond_dev); } - if (bond->params.mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) /* add lacpdu mc addr to mc list */ - u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR; - dev_mc_add(slave_dev, lacpdu_multicast); - } bond_add_vlans_on_slave(bond, slave_dev); @@ -1901,6 +1899,11 @@ err_dest_symlinks: bond_destroy_slave_symlinks(bond_dev, slave_dev); err_detach: + if (!USES_PRIMARY(bond->params.mode)) { + netif_addr_lock_bh(bond_dev); + bond_mc_list_flush(bond_dev, slave_dev); + netif_addr_unlock_bh(bond_dev); + } write_lock_bh(&bond->lock); bond_detach_slave(bond, new_slave); write_unlock_bh(&bond->lock);