Commit ffbf4c34 authored by Roland Dreier's avatar Roland Dreier Committed by Roland Dreier

[PATCH] IB: unmap FMRs when destroying FMR pool

Make sure that all FMRs are unmapped before we deallocate them so that
we don't leak references to our protection domain when destroying an
FMR pool.  (Bug reported by Guy German <guyg@voltaire.com>)
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 2e8b981c
...@@ -334,6 +334,7 @@ void ib_destroy_fmr_pool(struct ib_fmr_pool *pool) ...@@ -334,6 +334,7 @@ void ib_destroy_fmr_pool(struct ib_fmr_pool *pool)
{ {
struct ib_pool_fmr *fmr; struct ib_pool_fmr *fmr;
struct ib_pool_fmr *tmp; struct ib_pool_fmr *tmp;
LIST_HEAD(fmr_list);
int i; int i;
kthread_stop(pool->thread); kthread_stop(pool->thread);
...@@ -341,6 +342,11 @@ void ib_destroy_fmr_pool(struct ib_fmr_pool *pool) ...@@ -341,6 +342,11 @@ void ib_destroy_fmr_pool(struct ib_fmr_pool *pool)
i = 0; i = 0;
list_for_each_entry_safe(fmr, tmp, &pool->free_list, list) { list_for_each_entry_safe(fmr, tmp, &pool->free_list, list) {
if (fmr->remap_count) {
INIT_LIST_HEAD(&fmr_list);
list_add_tail(&fmr->fmr->list, &fmr_list);
ib_unmap_fmr(&fmr_list);
}
ib_dealloc_fmr(fmr->fmr); ib_dealloc_fmr(fmr->fmr);
list_del(&fmr->list); list_del(&fmr->list);
kfree(fmr); kfree(fmr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment