From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 5CBAF2BE2 for ; Tue, 23 Feb 2016 13:13:09 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 23 Feb 2016 04:13:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,489,1449561600"; d="scan'208";a="922020197" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 23 Feb 2016 04:13:06 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u1NCD4ui002649; Tue, 23 Feb 2016 12:13:04 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id u1NCD3Xd025045; Tue, 23 Feb 2016 12:13:03 GMT Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id u1NCD3jl025041; Tue, 23 Feb 2016 12:13:03 GMT From: Bernard Iremonger To: dev@dpdk.org Date: Tue, 23 Feb 2016 12:13:00 +0000 Message-Id: <1456229580-25009-1-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] bonding: fix crash when no slave devices X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Feb 2016 12:13:09 -0000 If a bonded device is created when there are no slave devices there is loop in bond_ethdev_promiscous_enable() which results in a segmentation fault. I have applied a similar fix to bond_ethdev_promiscous_disable() where a similar loop could occur. Fixes: 2efb58cbab6e ("bond: new link bonding library") Signed-off-by: Bernard Iremonger --- drivers/net/bonding/rte_eth_bond_pmd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index b63c886..78972fc 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -1870,7 +1870,8 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev) case BONDING_MODE_TLB: case BONDING_MODE_ALB: default: - rte_eth_promiscuous_enable(internals->current_primary_port); + if (internals->slave_count > 0) + rte_eth_promiscuous_enable(internals->current_primary_port); } } @@ -1898,7 +1899,8 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev) case BONDING_MODE_TLB: case BONDING_MODE_ALB: default: - rte_eth_promiscuous_disable(internals->current_primary_port); + if (internals->slave_count > 0) + rte_eth_promiscuous_disable(internals->current_primary_port); } } -- 2.6.3