net/idpf: fix crash when launching l3fwd
Checks
Commit Message
From: Beilei Xing <beilei.xing@intel.com>
There's core dump when launching l3fwd with 1 queue 1 core. It's
because NULL pointer is used if fail to configure device.
This patch removes incorrect check during device configuration,
and checks NULL pointer when excuting VIRTCHNL2_OP_DEALLOC_VECTORS.
Fixes: 549343c25db8 ("net/idpf: support device initialization")
Fixes: 70675bcc3a57 ("net/idpf: support RSS")
Fixes: 37291a68fd78 ("net/idpf: support write back based on ITR expire")
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
drivers/net/idpf/idpf_ethdev.c | 7 -------
drivers/net/idpf/idpf_vchnl.c | 3 +++
2 files changed, 3 insertions(+), 7 deletions(-)
@@ -372,13 +372,6 @@ idpf_dev_configure(struct rte_eth_dev *dev)
return -ENOTSUP;
}
- if ((dev->data->nb_rx_queues == 1 && conf->rxmode.mq_mode != RTE_ETH_MQ_RX_NONE) ||
- (dev->data->nb_rx_queues > 1 && conf->rxmode.mq_mode != RTE_ETH_MQ_RX_RSS)) {
- PMD_INIT_LOG(ERR, "Multi-queue packet distribution mode %d is not supported",
- conf->rxmode.mq_mode);
- return -ENOTSUP;
- }
-
if (conf->txmode.mq_mode != RTE_ETH_MQ_TX_NONE) {
PMD_INIT_LOG(ERR, "Multi-queue TX mode %d is not supported",
conf->txmode.mq_mode);
@@ -1197,6 +1197,9 @@ idpf_vc_dealloc_vectors(struct idpf_vport *vport)
int err, len;
alloc_vec = vport->recv_vectors;
+ if (alloc_vec == NULL)
+ return -EINVAL;
+
vcs = &alloc_vec->vchunks;
len = sizeof(struct virtchnl2_vector_chunks) +