]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
IB/hfi1: Correct guard on eager buffer deallocation
authorMike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
Mon, 29 Nov 2021 19:19:52 +0000 (14:19 -0500)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 7 Dec 2021 17:22:53 +0000 (13:22 -0400)
The code tests the dma address which legitimately can be 0.

The code should test the kernel logical address to avoid leaking eager
buffer allocations that happen to map to a dma address of 0.

Fixes: 60368186fd85 ("IB/hfi1: Fix user-space buffers mapping with IOMMU enabled")
Link: https://lore.kernel.org/r/20211129191952.101968.17137.stgit@awfm-01.cornelisnetworks.com
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hfi1/init.c

index dbd1c31830b9c22e0f405db3149d5c9effdaf59b..8e1236be46e11a230446757873b4f6428824073d 100644 (file)
@@ -1120,7 +1120,7 @@ void hfi1_free_ctxtdata(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd)
        rcd->egrbufs.rcvtids = NULL;
 
        for (e = 0; e < rcd->egrbufs.alloced; e++) {
-               if (rcd->egrbufs.buffers[e].dma)
+               if (rcd->egrbufs.buffers[e].addr)
                        dma_free_coherent(&dd->pcidev->dev,
                                          rcd->egrbufs.buffers[e].len,
                                          rcd->egrbufs.buffers[e].addr,