[PATCH] app/testpmd: fix segment fault with invalid queue id

huangdengdui huangdengdui at huawei.com
Fri May 19 12:18:53 CEST 2023


On 2023/5/16 23:12, Stephen Hemminger wrote:
> On Tue, 16 May 2023 19:00:21 +0800
> Dengdui Huang <huangdengdui at huawei.com> wrote:
> 
>> When input queue id is invalid, it will lead to
>> Segmentation fault, like:
>>
>> dpdk-testpmd -a 0000:01:00.0 -- -i
>> testpmd> show port 0 txq/rxq 99 desc 0 status  
>> Segmentation fault
>>
>> dpdk-testpmd -a 0000:01:00.0 -- -i
>> testpmd> show port 0 rxq 99 desc used count  
>> Segmentation fault
>>
>> This patch fixes it.
>>
>> In addition, this patch add the check for the offset
>> of the descriptor in case of other anomalies.
>>
>> Fixes: fae9aa717d6c ("app/testpmd: support checking descriptor status")
>> Fixes: 3f9acb5c83bb ("ethdev: avoid non-dataplane checks in Rx queue count")
>> Cc: stable at dpdk.org
>>
>> Signed-off-by: Dengdui Huang <huangdengdui at huawei.com>
> 
> What is the backtrace and device driver?  The problem is that other users
> besides testpmd might hit same problem.
> 
> It would make sense to have a function to test for valid rx and tx queue id
> in rte_ethdev. Similar to existing rte_eth_dev_is_valid_port() rather than
> open coding it.  Maybe rte_eth_dev_is_valid_rxq(port_id, queue_id)?
> 
> here was talk that the existing rx queue descriptor status is racy, and
> unused by any real application; and therefore would be good candidate for
> future removal.
Hi, Stephen

OK.

Agreed. But these APIs are still in dpdk, so testpmd as user side should use them correctly.

Thanks,
Dengdui


More information about the dev mailing list