net/iavf: fix access to null value
PATCH 1/1 net/iavf: fix access to null value
The "vsi" may be null, so it needs to be used after checking.
Fixes ab28aad9c24f ("net/iavf: fix Rx Tx burst in multi-process")
Signed-off-by Mingjin Ye <[email protected]>
--- drivers/net/iavf/iavf_rxtx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/iavf/iavf_rxtx.c +6 -4
@@ -3781,12 +3781,13 @@ iavf_recv_pkts_no_poll(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) {struct iavf_rx_queue *rxq = rx_queue; -enum iavf_rx_burst_type rx_burst_type = - rxq->vsi->adapter->rx_burst_type; +enum iavf_rx_burst_type rx_burst_type;if (!rxq->vsi || rxq->vsi->adapter->no_poll)return 0 ; + rx_burst_type = rxq->vsi->adapter->rx_burst_type; +return iavf_rx_pkt_burst_ops[rx_burst_type](rx_queue, rx_pkts, nb_pkts); }
@@ -3796,12 +3797,13 @@ iavf_xmit_pkts_no_poll(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) {struct iavf_tx_queue *txq = tx_queue; -enum iavf_tx_burst_type tx_burst_type = - txq->vsi->adapter->tx_burst_type; +enum iavf_tx_burst_type tx_burst_type;if (!txq->vsi || txq->vsi->adapter->no_poll)return 0 ; + tx_burst_type = txq->vsi->adapter->tx_burst_type; +return iavf_tx_pkt_burst_ops[tx_burst_type](tx_queue, tx_pkts, nb_pkts); }
Signature · 1 line
2.25.1
Quoted 10 lines · Mingjin Ye
The "vsi" may be null, so it needs to be used after checking.
Fixes ab28aad9c24f ("net/iavf: fix Rx Tx burst in multi-process")Signed-off-by Mingjin Ye <[email protected]>--- drivers/net/iavf/iavf_rxtx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
This looks safer with the checks this way.
Acked-by Bruce Richardson <[email protected]>
Quoted 7 lines · Mingjin Ye
The "vsi" may be null, so it needs to be used after checking.
Fixes ab28aad9c24f ("net/iavf: fix Rx Tx burst in multi-process")Signed-off-by Mingjin Ye <[email protected]>---
Acked-by Anatoly Burakov <[email protected]>
Signature · 2 lines
Thanks, Anatoly
Bruce Richardson
AppliedQuoted 4 lines · Anatoly
Quoted 3 lines · Mingjin Ye
The "vsi" may be null, so it needs to be used after checking.
Fixes ab28aad9c24f ("net/iavf: fix Rx Tx burst in multi-process")
Fixes 9f6186cf0d80 ("net/iavf: fix Rx/Tx burst in multi-process")
Quoted 6 lines
Quoted 4 lines
Signed-off-by Mingjin Ye <[email protected]>---
Acked-by Anatoly Burakov <[email protected]>
Applied to dpdk-next-net-intel.
Thanks,
/Bruce