On 09/04/2025 13:37, Ilya Maximets wrote:
> On 4/8/25 4:33 PM, Kevin Traynor wrote:
>> From: Jay Ding <jay.d...@broadcom.com>
>>
>> rte_eth_dev_info_get() could fail due to device reset, etc.
>>
>> The return value should be checked before the device info
>> pointer is dereferenced.
>>
>> Fixes: 2f196c80e716 ("netdev-dpdk: Use LSC interrupt mode.")
>> Signed-off-by: Jay Ding <jay.d...@broadcom.com>
>> Signed-off-by: Kevin Traynor <ktray...@redhat.com>
>> ---
>>  lib/netdev-dpdk.c | 12 ++++++++----
>>  1 file changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
>> index 549887b31..03a919962 100644
>> --- a/lib/netdev-dpdk.c
>> +++ b/lib/netdev-dpdk.c
>> @@ -2333,5 +2333,4 @@ netdev_dpdk_set_config(struct netdev *netdev, const 
>> struct smap *args,
>>      const char *vf_mac;
>>      int err = 0;
>> -    int ret;
>>  
>>      ovs_mutex_lock(&dpdk_mutex);
>> @@ -2397,8 +2396,13 @@ netdev_dpdk_set_config(struct netdev *netdev, const 
>> struct smap *args,
>>      }
>>  
>> -    ret = rte_eth_dev_info_get(dev->port_id, &info);
>> +    err = -rte_eth_dev_info_get(dev->port_id, &info);
>> +    if (err) {
>> +        VLOG_ERR("Interface %s rte_eth_dev_info_get error: %s",
>> +                 dev->up.name, rte_strerror(err));
> 
> A few things here:
> 
> 1. Should be netdev_get_name() instead of a direct access.
> 2. ERR is for internal errors, this should be a warning.  Since this issue
>    prevents adding the device, it must be reported via WARN_BUF for errp,
>    so it can be propagated back the database.
> 3. Maybe a bit more user-readable message like:
>    "%s: Failed to get device info: %s" ?
> 

Sounds good, thanks. I will submit a v4 with these.

> Best regards, Ilya Maximets.
> 
>> +        goto out;
>> +    }
>>  
>> -    dpdk_process_queue_size(netdev, args, !ret ? &info : NULL, true);
>> -    dpdk_process_queue_size(netdev, args, !ret ? &info : NULL, false);
>> +    dpdk_process_queue_size(netdev, args, &info, true);
>> +    dpdk_process_queue_size(netdev, args, &info, false);
>>  
>>      vf_mac = smap_get(args, "dpdk-vf-mac");
> 

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to