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.

Fixes: dc955cd24c8f ("net/nbl: add coexistence mode")
Cc: [email protected]
Cc: [email protected]

Signed-off-by: Anatoly Burakov <[email protected]>
---

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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/nbl/nbl_common/nbl_userdev.c 
b/drivers/net/nbl/nbl_common/nbl_userdev.c
index 96f0d2e264..53f18fd00f 100644
--- a/drivers/net/nbl/nbl_common/nbl_userdev.c
+++ b/drivers/net/nbl/nbl_common/nbl_userdev.c
@@ -549,6 +549,7 @@ static int nbl_mdev_unmap_device(struct nbl_adapter 
*adapter)
 
        close(common->devfd);
        rte_mcfg_mem_read_lock();
+       TAILQ_REMOVE(&nbl_adapter_list, adapter, next);
        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

Reply via email to