net/bonding: check dequeue result before proceeding
authorRadu Nicolau <radu.nicolau@intel.com>
Wed, 24 Jan 2018 13:11:13 +0000 (13:11 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 29 Jan 2018 09:04:28 +0000 (10:04 +0100)
Coverity issue: 257015
Fixes: 09150784a776 ("net/bonding: burst mode hash calculation")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
drivers/net/bonding/rte_eth_bond_pmd.c

index a86bcaf..92ad688 100644 (file)
@@ -1435,17 +1435,17 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf **bufs,
                if (likely(rte_ring_empty(port->tx_ring)))
                        continue;
 
-               rte_ring_dequeue(port->tx_ring, (void **)&ctrl_pkt);
-
-               slave_tx_count = rte_eth_tx_burst(slave_port_ids[i],
+               if (rte_ring_dequeue(port->tx_ring,
+                                    (void **)&ctrl_pkt) != -ENOENT) {
+                       slave_tx_count = rte_eth_tx_burst(slave_port_ids[i],
                                        bd_tx_q->queue_id, &ctrl_pkt, 1);
-
-               /*
-                * re-enqueue LAG control plane packets to buffering
-                * ring if transmission fails so the packet isn't lost.
-                */
-               if (slave_tx_count != 1)
-                       rte_ring_enqueue(port->tx_ring, ctrl_pkt);
+                       /*
+                        * re-enqueue LAG control plane packets to buffering
+                        * ring if transmission fails so the packet isn't lost.
+                        */
+                       if (slave_tx_count != 1)
+                               rte_ring_enqueue(port->tx_ring, ctrl_pkt);
+               }
        }
 
        return total_tx_count;