* [dpdk-dev] [PATCH] ethdev: check if queues are allocated before getting info
@ 2020-10-01 18:14 Ferruh Yigit
2020-10-01 19:40 ` Ajit Khaparde
0 siblings, 1 reply; 3+ messages in thread
From: Ferruh Yigit @ 2020-10-01 18:14 UTC (permalink / raw)
To: Thomas Monjalon, Andrew Rybchenko, Wei Hu (Xavier); +Cc: dev, Ferruh Yigit
A crash is detected when '--txpkts=#' parameter provided to the testpmd,
this is because queue information is requested before queues have been
allocated.
Adding check to queue info APIs
('rte_eth_rx_queue_info_get()' & 'rte_eth_tx_queue_info_get')
to protect against similar cases.
Fixes: ba2fb4f022fc ("ethdev: check if queue setup when getting queue info")
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
lib/librte_ethdev/rte_ethdev.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 0f56541fbc..9805184633 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -4688,7 +4688,8 @@ rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
return -EINVAL;
}
- if (dev->data->rx_queues[queue_id] == NULL) {
+ if (dev->data->rx_queues == NULL ||
+ dev->data->rx_queues[queue_id] == NULL) {
RTE_ETHDEV_LOG(ERR,
"Rx queue %"PRIu16" of device with port_id=%"
PRIu16" has not been setup\n",
@@ -4727,7 +4728,8 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
return -EINVAL;
}
- if (dev->data->tx_queues[queue_id] == NULL) {
+ if (dev->data->tx_queues == NULL ||
+ dev->data->tx_queues[queue_id] == NULL) {
RTE_ETHDEV_LOG(ERR,
"Tx queue %"PRIu16" of device with port_id=%"
PRIu16" has not been setup\n",
--
2.26.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] ethdev: check if queues are allocated before getting info
2020-10-01 18:14 [dpdk-dev] [PATCH] ethdev: check if queues are allocated before getting info Ferruh Yigit
@ 2020-10-01 19:40 ` Ajit Khaparde
2020-10-05 15:13 ` Ferruh Yigit
0 siblings, 1 reply; 3+ messages in thread
From: Ajit Khaparde @ 2020-10-01 19:40 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: Thomas Monjalon, Andrew Rybchenko, Wei Hu (Xavier), dpdk-dev
On Thu, Oct 1, 2020 at 11:14 AM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> A crash is detected when '--txpkts=#' parameter provided to the testpmd,
> this is because queue information is requested before queues have been
> allocated.
>
> Adding check to queue info APIs
> ('rte_eth_rx_queue_info_get()' & 'rte_eth_tx_queue_info_get')
> to protect against similar cases.
>
> Fixes: ba2fb4f022fc ("ethdev: check if queue setup when getting queue info")
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
> lib/librte_ethdev/rte_ethdev.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index 0f56541fbc..9805184633 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -4688,7 +4688,8 @@ rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
> return -EINVAL;
> }
>
> - if (dev->data->rx_queues[queue_id] == NULL) {
> + if (dev->data->rx_queues == NULL ||
> + dev->data->rx_queues[queue_id] == NULL) {
> RTE_ETHDEV_LOG(ERR,
> "Rx queue %"PRIu16" of device with port_id=%"
> PRIu16" has not been setup\n",
> @@ -4727,7 +4728,8 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
> return -EINVAL;
> }
>
> - if (dev->data->tx_queues[queue_id] == NULL) {
> + if (dev->data->tx_queues == NULL ||
> + dev->data->tx_queues[queue_id] == NULL) {
> RTE_ETHDEV_LOG(ERR,
> "Tx queue %"PRIu16" of device with port_id=%"
> PRIu16" has not been setup\n",
> --
> 2.26.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] ethdev: check if queues are allocated before getting info
2020-10-01 19:40 ` Ajit Khaparde
@ 2020-10-05 15:13 ` Ferruh Yigit
0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2020-10-05 15:13 UTC (permalink / raw)
To: Ajit Khaparde
Cc: Thomas Monjalon, Andrew Rybchenko, Wei Hu (Xavier), dpdk-dev
On 10/1/2020 8:40 PM, Ajit Khaparde wrote:
> On Thu, Oct 1, 2020 at 11:14 AM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>
>> A crash is detected when '--txpkts=#' parameter provided to the testpmd,
>> this is because queue information is requested before queues have been
>> allocated.
>>
>> Adding check to queue info APIs
>> ('rte_eth_rx_queue_info_get()' & 'rte_eth_tx_queue_info_get')
>> to protect against similar cases.
>>
>> Fixes: ba2fb4f022fc ("ethdev: check if queue setup when getting queue info")
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>
> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
>
Applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-05 15:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-01 18:14 [dpdk-dev] [PATCH] ethdev: check if queues are allocated before getting info Ferruh Yigit
2020-10-01 19:40 ` Ajit Khaparde
2020-10-05 15:13 ` Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).