diff options
author | Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com> | 2021-11-29 14:19:52 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-12-14 10:04:47 +0100 |
commit | ce33ba0bfded5a8b102f5b0d123d9a4a6e446ece (patch) | |
tree | 011d77569517eb25fd498366707034b14553f9b2 /drivers/infiniband | |
parent | 69bb79a8f5bb9f436b6f1434ca9742591b7bbe18 (diff) | |
download | linux-stable-ce33ba0bfded5a8b102f5b0d123d9a4a6e446ece.tar.gz linux-stable-ce33ba0bfded5a8b102f5b0d123d9a4a6e446ece.tar.bz2 linux-stable-ce33ba0bfded5a8b102f5b0d123d9a4a6e446ece.zip |
IB/hfi1: Correct guard on eager buffer deallocation
commit 9292f8f9a2ac42eb320bced7153aa2e63d8cc13a upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/hfi1/init.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c index 9dc8cf096e2e..93ace2609bdd 100644 --- a/drivers/infiniband/hw/hfi1/init.c +++ b/drivers/infiniband/hw/hfi1/init.c @@ -955,7 +955,7 @@ void hfi1_free_ctxtdata(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) kfree(rcd->egrbufs.rcvtids); 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, |