[SRU][N:linux-bluefield][PATCH v1 2/2] UBUNTU: SAUCE: vfio/pci: Use the correct ref count

Stav Aviram saviram at nvidia.com
Thu Apr 16 12:14:06 UTC 2026


From: Amir Tzin <amirtz at nvidia.com>

BugLink: https://bugs.launchpad.net/bugs/2148554

Cited patch, on its cleanup flows, fails to clear the vfio device
refcount. Instead it calls vfio_put_device triggering [1].

[1]
[] Call trace:
[] refcount_warn_saturate+0x140/0×238
[] kobject_put+0x12c/0×160
[] put_device+0x20/0×58
[] vfio_pci_dma_buf_release+0x60/0×98 [vfio_pci_core]
[] dma_buf_release+0x4c/0xc8
[] dentry_kill+0xec/0×210
[] dput+0x94/0×110
[] fput+0xd8/0×318
[] fput_sync+0x78/0xb0
[] arm64_sys_close+0x44/0xa0
[] invoke_syscall+0x7c/0×130
[] el0_svc_common.constprop.0+0x4c/0×140
[] do_el0_svc+0x28/0×58
[] el0_svc+0x40/0×1c0
[] el0t_64_sync+0x1b0/0×1b8
[] el0t_64_sync_handler+0x148/0×158
[] -[ end trace 0000000000000000 ]—-

Issue: 4933425
Fixes: 25538ae6b589 ("UBUNTU: SAUCE: vfio/pci: Allow MMIO regions to be exported through dma-buf")
Signed-off-by: Amir Tzin <amirtz at nvidia.com>
---
 drivers/vfio/pci/dma_buf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/vfio/pci/dma_buf.c b/drivers/vfio/pci/dma_buf.c
index 0ad8545cbac5..d8c11816211f 100644
--- a/drivers/vfio/pci/dma_buf.c
+++ b/drivers/vfio/pci/dma_buf.c
@@ -147,7 +147,7 @@ static void vfio_pci_dma_buf_release(struct dma_buf *dmabuf)
 		down_write(&priv->vdev->memory_lock);
 		list_del_init(&priv->dmabufs_elm);
 		up_write(&priv->vdev->memory_lock);
-		vfio_put_device(&priv->vdev->vdev);
+		vfio_device_put_registration(&priv->vdev->vdev);
 	}
 	kfree(priv);
 }
@@ -258,7 +258,7 @@ void vfio_pci_dma_buf_cleanup(struct vfio_pci_core_device *vdev)
 		priv->revoked = true;
 		dma_buf_move_notify(priv->dmabuf);
 		dma_resv_unlock(priv->dmabuf->resv);
-		vfio_put_device(&vdev->vdev);
+		vfio_device_put_registration(&vdev->vdev);
 		dma_buf_put(priv->dmabuf);
 	}
 	up_write(&vdev->memory_lock);
-- 
2.38.1




More information about the kernel-team mailing list