[dpdk-dev] [PATCH] net/bonding: validate bonded port id before access its data

Herbert Guan herbert.guan at arm.com
Mon Jul 31 05:24:33 CEST 2017


Fixes: 4c42498d916d ("net/bonding: allow slaves to also be bonded devices")

Signed-off-by: Herbert Guan <herbert.guan at arm.com>
---
 drivers/net/bonding/rte_eth_bond_api.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 824ab4f..6039500 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -514,11 +514,11 @@
 {
 	struct bond_dev_private *internals;
 
-	internals =  rte_eth_devices[bonded_port_id].data->dev_private;
-
 	if (valid_bonded_port_id(bonded_port_id) != 0)
 		return -1;
 
+	internals =  rte_eth_devices[bonded_port_id].data->dev_private;
+
 	if (valid_slave_port_id(slave_port_id, internals->mode) != 0)
 		return -1;
 
-- 
1.8.3.1



More information about the dev mailing list