On Fri, Oct 17, 2025 at 08:40:07AM +0300, Leon Romanovsky wrote:
+static void vfio_pci_dma_buf_detach(struct dma_buf *dmabuf,
struct dma_buf_attachment *attachment)
+{
- kfree(attachment->priv);
+}
If the caller fails to call map then it leaks the iova.
I'm relying on dmabuf code and documentation:
926 /** 927 * dma_buf_dynamic_attach - Add the device to dma_buf's attachments list ... 932 * 933 * Returns struct dma_buf_attachment pointer for this attachment. Attachments 934 * must be cleaned up by calling dma_buf_detach().
Successful call to vfio_pci_dma_buf_attach() MUST be accompanied by call to vfio_pci_dma_buf_detach(), so as far as dmabuf implementation follows it, there is no leak.
It leaks the ivoa because there is no dma_iova_destroy() unless you call unmap. detach is not unmap and unmap is not mandatory to call.
Jason