summaryrefslogtreecommitdiff
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorRadu Nicolau <radu.nicolau@intel.com>2018-11-08 15:26:42 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2018-11-14 00:35:53 +0100
commit0911d4ec01839c9149a0df5758d00d9d57a47cea (patch)
tree80eb37537e32f997915781301ac9a24c2fda86d1 /drivers/net/bonding
parent39ae74caa0d1158df15ea1e2f8e893eee1a2189d (diff)
downloaddpdk-next-eventdev-0911d4ec01839c9149a0df5758d00d9d57a47cea.zip
dpdk-next-eventdev-0911d4ec01839c9149a0df5758d00d9d57a47cea.tar.gz
dpdk-next-eventdev-0911d4ec01839c9149a0df5758d00d9d57a47cea.tar.xz
net/bonding: fix crash when stopping mode 4 port
When stopping a bonded port all slaves are deactivated. Attempting to deactivate a slave that was never activated will result in a segfault when mode 4 is used. Fixes: 7486331308f6 ("net/bonding: stop and deactivate slaves on stop") Cc: stable@dpdk.org Signed-off-by: Radu Nicolau <radu.nicolau@intel.com> Acked-by: Chas Williams <chas3@att.com>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/rte_eth_bond_pmd.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 1a6d8e4..2661620 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2181,9 +2181,14 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev)
internals->link_status_polling_enabled = 0;
for (i = 0; i < internals->slave_count; i++) {
- internals->slaves[i].last_link_status = 0;
- rte_eth_dev_stop(internals->slaves[i].port_id);
- deactivate_slave(eth_dev, internals->slaves[i].port_id);
+ uint16_t slave_id = internals->slaves[i].port_id;
+ if (find_slave_by_id(internals->active_slaves,
+ internals->active_slave_count, slave_id) !=
+ internals->active_slave_count) {
+ internals->slaves[i].last_link_status = 0;
+ rte_eth_dev_stop(slave_id);
+ deactivate_slave(eth_dev, slave_id);
+ }
}
}