This patch adds checking whether the related Tx or Rx queue has been
setup in the queue-related API functions to avoid illegal address
access.
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
return -EINVAL;
}
+ if (dev->data->rx_queues[rx_queue_id] == NULL) {
+ port_id = dev->data->port_id;
+ RTE_ETHDEV_LOG(ERR,
+ "Queue %u of device with port_id=%u has not been setup\n",
+ rx_queue_id, port_id);
+ return -EINVAL;
+ }
+
return 0;
}
return -EINVAL;
}
+ if (dev->data->tx_queues[tx_queue_id] == NULL) {
+ port_id = dev->data->port_id;
+ RTE_ETHDEV_LOG(ERR,
+ "Queue %u of device with port_id=%u has not been setup\n",
+ tx_queue_id, port_id);
+ return -EINVAL;
+ }
+
return 0;
}
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_queue_count, -ENOTSUP);
- if (queue_id >= dev->data->nb_rx_queues)
+ if (queue_id >= dev->data->nb_rx_queues ||
+ dev->data->rx_queues[queue_id] == NULL)
return -EINVAL;
return (int)(*dev->rx_queue_count)(dev, queue_id);