diff options
author | Mitko Haralanov <mitko.haralanov@intel.com> | 2016-04-12 10:46:23 -0700 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-04-28 16:32:26 -0400 |
commit | 4787bc5e1783e94f6b9518664609f3034dc799eb (patch) | |
tree | d4c932467635321d0cb9a748c19fbfe2a986b5a2 /drivers/staging/rdma | |
parent | 747f4d7a9d1bc07e3f9f22c84201ffb0abee1634 (diff) | |
download | linux-4787bc5e1783e94f6b9518664609f3034dc799eb.tar.bz2 |
IB/hfi1: Don't remove list entries if they are not in a list
The SDMA cache logic maintains an eviction list which is ordered
by most recently used user buffers. Upon errors or buffer freeing,
the list nodes were unconditionally being deleted. This would lead
to list corruption warnings if the nodes were never inserted in the
eviction list to begin with.
This commit prevents this by checking that the nodes are already
part of the eviction list.
Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/staging/rdma')
-rw-r--r-- | drivers/staging/rdma/hfi1/user_sdma.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/staging/rdma/hfi1/user_sdma.c b/drivers/staging/rdma/hfi1/user_sdma.c index d53a659548e0..032949bac801 100644 --- a/drivers/staging/rdma/hfi1/user_sdma.c +++ b/drivers/staging/rdma/hfi1/user_sdma.c @@ -1135,7 +1135,8 @@ retry: ret = hfi1_mmu_rb_insert(&req->pq->sdma_rb_root, &node->rb); if (ret) { spin_lock(&pq->evict_lock); - list_del(&node->list); + if (!list_empty(&node->list)) + list_del(&node->list); pq->n_locked -= node->npages; spin_unlock(&pq->evict_lock); ret = 0; @@ -1558,7 +1559,8 @@ static void sdma_rb_remove(struct rb_root *root, struct mmu_rb_node *mnode, container_of(mnode, struct sdma_mmu_node, rb); spin_lock(&node->pq->evict_lock); - list_del(&node->list); + if (!list_empty(&node->list)) + list_del(&node->list); node->pq->n_locked -= node->npages; spin_unlock(&node->pq->evict_lock); |