aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rdma/hfi1/user_sdma.c
diff options
context:
space:
mode:
authorMitko Haralanov <mitko.haralanov@intel.com>2016-04-12 10:46:29 -0700
committerDoug Ledford <dledford@redhat.com>2016-04-28 16:32:26 -0400
commit0ad2d3d05b4a597d1f2e239dcc6ab537cc3eeacb (patch)
tree06d2c25b74885670f776821b8b9447c6a0e9f9b4 /drivers/staging/rdma/hfi1/user_sdma.c
parentIB/hfi1: Don't remove list entries if they are not in a list (diff)
downloadlinux-dev-0ad2d3d05b4a597d1f2e239dcc6ab537cc3eeacb.tar.xz
linux-dev-0ad2d3d05b4a597d1f2e239dcc6ab537cc3eeacb.zip
IB/hfi1: Fix memory leak in user ExpRcv and SDMA
The driver had two memory leaks - one in the user expected receive code and one in SDMA buffer cache. The leak in the expected receive code only showed up when the user/admin had set ulimit sufficiently low and the driver did not have enough room in the cache before hitting the limit of allowed cachable memory. When this condition occurred, the driver returned early signaling userland that it needed to free some buffers to free up room in the cache. The bug was that the driver was not cleaning up allocated memory prior to returning early. The leak in the SDMA buffer cache could occur (even though it never did), when the insertion of a buffer node in the interval RB tree failed. In this case, the driver failed to unpin the pages of the node instead erroneously returning success. Reviewed-by: Dean Luick <dean.luick@intel.com> Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to '')
-rw-r--r--drivers/staging/rdma/hfi1/user_sdma.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/staging/rdma/hfi1/user_sdma.c b/drivers/staging/rdma/hfi1/user_sdma.c
index 032949bac801..044d33777fba 100644
--- a/drivers/staging/rdma/hfi1/user_sdma.c
+++ b/drivers/staging/rdma/hfi1/user_sdma.c
@@ -1139,7 +1139,8 @@ retry:
list_del(&node->list);
pq->n_locked -= node->npages;
spin_unlock(&pq->evict_lock);
- ret = 0;
+ unpin_vector_pages(current->mm, node->pages, 0,
+ node->npages);
goto bail;
}
} else {