[PATCH v2 1/1] net/nbl: fix use-after-free
Anatoly Burakov
anatoly.burakov at intel.com
Thu Aug 27 10:47:55 CEST 2026
When unmapping a device, the device is not removed from TAILQ, which may
result in attempting to access this devices' data during subsequent mem
event callbacks (as they are only disabled once all devices are removed).
Remove the device from TAILQ on unmap to fix it, and move the device fd
close under the memcfg lock to avoid race between a mem event and fd close.
Fixes: dc955cd24c8f ("net/nbl: add coexistence mode")
Cc: dimon.zhao at nebula-matrix.com
Cc: stable at dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
Notes:
This fix is AI generated, please review carefully. It looks reasonable to me,
but this isn't a driver/use case I know well.
drivers/net/nbl/nbl_common/nbl_userdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/nbl/nbl_common/nbl_userdev.c b/drivers/net/nbl/nbl_common/nbl_userdev.c
index 96f0d2e264..ec6840d60e 100644
--- a/drivers/net/nbl/nbl_common/nbl_userdev.c
+++ b/drivers/net/nbl/nbl_common/nbl_userdev.c
@@ -547,8 +547,9 @@ static int nbl_mdev_unmap_device(struct nbl_adapter *adapter)
struct nbl_common_info *common = &adapter->common;
int vfio_group_fd, ret;
- close(common->devfd);
rte_mcfg_mem_read_lock();
+ TAILQ_REMOVE(&nbl_adapter_list, adapter, next);
+ close(common->devfd);
vfio_group_fd = rte_vfio_container_group_bind(nbl_default_container,
common->iommu_group_num);
NBL_LOG(DEBUG, "close vfio_group_fd %d", vfio_group_fd);
--
2.52.0
More information about the dev
mailing list