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

Message ID 1501471473-3092-1-git-send-email-herbert.guan@arm.com (mailing list archive)
State Rejected, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Herbert Guan July 31, 2017, 3:24 a.m. UTC
  Fixes: 4c42498d916d ("net/bonding: allow slaves to also be bonded devices")

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

Comments

Ferruh Yigit July 31, 2017, 9:59 a.m. UTC | #1
On 7/31/2017 4:24 AM, Herbert Guan wrote:
> Fixes: 4c42498d916d ("net/bonding: allow slaves to also be bonded devices")
> 
> Signed-off-by: Herbert Guan <herbert.guan@arm.com>

Thanks for the patch, this looks like duplicate [1], I will get the
other one since it has been sent earlier.

[1]
http://dpdk.org/dev/patchwork/patch/27225/

Thanks,
ferruh
  

Patch

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;