On 11/5/2021 1:36 PM, Andrew Rybchenko wrote:
On 11/5/21 4:16 PM, Thomas Monjalon wrote:
05/11/2021 04:03, Xia, Chenbo:
From: stable <stable-boun...@dpdk.org> On Behalf Of Ferruh Yigit
'eth_dev->data' can be null before ethdev allocated. The API walks
through all eth devices, at least for some data can be null.
Adding 'eth_dev->data' null check before accessing it.
Fixes: 33c73aae32e4 ("ethdev: allow ownership operations on unused port")
Cc: sta...@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yi...@intel.com>
[...]
@@ -757,10 +757,13 @@ rte_eth_dev_owner_delete(const uint64_t owner_id)
rte_spinlock_lock(ð_dev_shared_data->ownership_lock);
if (eth_is_valid_owner_id(owner_id)) {
- for (port_id = 0; port_id < RTE_MAX_ETHPORTS; port_id++)
- if (rte_eth_devices[port_id].data->owner.id == owner_id)
- memset(&rte_eth_devices[port_id].data->owner, 0,
+ for (port_id = 0; port_id < RTE_MAX_ETHPORTS; port_id++) {
+ struct rte_eth_dev_data *data =
+ rte_eth_devices[port_id].data;
+ if (data != NULL && data->owner.id == owner_id)
Indeed the NULL check was missing.
Acked-by: Chenbo Xia <chenbo....@intel.com>
Acked-by: Thomas Monjalon <tho...@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybche...@oktetlabs.ru>
Applied to dpdk-next-net/main, thanks.