net/bonding: fix check slaves link properties
authorTomasz Kulasek <tomaszx.kulasek@intel.com>
Fri, 20 Oct 2017 15:49:26 +0000 (17:49 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 26 Oct 2017 00:33:01 +0000 (02:33 +0200)
Result of slaves link properties validation is not used when new slave
is added.

This patch uses the value of link_properties_valid() to determinate if
slave can be used in the bonding. If function fails, error is returned
preventing to add slave with invalid link properties.

Coverity issue: 158661
Fixes: deba8a2f8b0b ("net/bonding: fix link properties management")
Cc: stable@dpdk.org
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/bonding/rte_eth_bond_api.c

index 529aae3..8c602f8 100644 (file)
@@ -302,8 +302,13 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id)
                internals->tx_offload_capa &= dev_info.tx_offload_capa;
                internals->flow_type_rss_offloads &= dev_info.flow_type_rss_offloads;
 
-               link_properties_valid(bonded_eth_dev,
-                               &slave_eth_dev->data->dev_link);
+               if (link_properties_valid(bonded_eth_dev,
+                               &slave_eth_dev->data->dev_link) != 0) {
+                       RTE_BOND_LOG(ERR, "Invalid link properties for slave %d"
+                                       " in bonding mode %d", slave_port_id,
+                                       internals->mode);
+                       return -1;
+               }
 
                /* RETA size is GCD of all slaves RETA sizes, so, if all sizes will be
                 * the power of 2, the lower one is GCD