[PATCH] net/nbl: fix late device data check in configure callback
Stephen Hemminger
stephen at networkplumber.org
Thu Dec 3 22:22:46 CET 2026
On Wed, 2 Dec 2026 14:24:43 +0300
Oleg Kotkov <Oleg.Kotkov at kaspersky.com> wrote:
> nbl_dev_configure() reads eth_dev->data->dev_private before checking
> whether eth_dev->data is NULL. Move the adapter lookup after the check
> so the callback can return -EINVAL when device data is missing.
>
> Fixes: 93b38df5a2ec ("net/nbl: support basic configuration")
> Cc: stable at dpdk.org
>
> Signed-off-by: Oleg Kotkov <Oleg.Kotkov at kaspersky.com>
> ---
Some AI review warnings:
Warning
-------
net/nbl: fix late device data check in configure callback
The reordered condition cannot occur, so the patch changes no
behaviour and only adds lines.
dev_data = eth_dev->data;
if (dev_data == NULL)
return -EINVAL;
rte_eth_dev_configure() dereferences dev->data before it dispatches to
the PMD. It reads dev->data->dev_started and then writes
dev->data->dev_configured = 0, both in rte_ethdev.c well ahead of the
dev_ops->dev_configure(dev) call at rte_ethdev.c:1672, which is the
only call site. A NULL eth_dev->data would have crashed in ethdev and
never reached this callback.
The adapter check is unreachable for the same reason.
ETH_DEV_TO_NBL_DEV_PF_PRIV() returns eth_dev->data->dev_private, and
dev_private is allocated by rte_eth_dev_pci_allocate(), which calls
rte_eth_dev_release_port() and returns NULL if that allocation fails.
Probe then fails, so a port that reaches dev_configure always has a
non-NULL adapter.
Delete both checks instead of reordering them:
int nbl_dev_configure(struct rte_eth_dev *eth_dev)
{
struct rte_eth_dev_data *dev_data = eth_dev->data;
struct nbl_adapter *adapter =
ETH_DEV_TO_NBL_DEV_PF_PRIV(eth_dev);
int ret;
NBL_LOG(DEBUG, "Begin to configure the device, state: %d",
adapter->state);
With no reachable bug, drop the Fixes: tag and Cc: stable at dpdk.org as
well; there is nothing for the stable trees to pick up.
More information about the stable
mailing list