[PATCH v4 8/8] vfio: Validate dma-buf revocation semantics

From: Leon Romanovsky

Date: Wed Jan 21 2026 - 08:24:26 EST


From: Leon Romanovsky <leonro@xxxxxxxxxx>

Use the new dma_buf_attach_revocable() helper to restrict attachments to
importers that support mapping invalidation.

Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>
---
drivers/vfio/pci/vfio_pci_dmabuf.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/vfio/pci/vfio_pci_dmabuf.c b/drivers/vfio/pci/vfio_pci_dmabuf.c
index 5fceefc40e27..85056a5a3faf 100644
--- a/drivers/vfio/pci/vfio_pci_dmabuf.c
+++ b/drivers/vfio/pci/vfio_pci_dmabuf.c
@@ -31,6 +31,9 @@ static int vfio_pci_dma_buf_attach(struct dma_buf *dmabuf,
if (priv->revoked)
return -ENODEV;

+ if (!dma_buf_attach_revocable(attachment))
+ return -EOPNOTSUPP;
+
return 0;
}


--
2.52.0