]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] IB: unmap FMRs when destroying FMR pool
authorRoland Dreier <roland@eddore.topspincom.com>
Mon, 15 Aug 2005 14:35:16 +0000 (07:35 -0700)
committerRoland Dreier <rolandd@cisco.com>
Sat, 27 Aug 2005 03:37:36 +0000 (20:37 -0700)
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: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/core/fmr_pool.c

index 7763b31abba70b61f8d2c1557b98f1cd2c2c06d6..1f7374927f380bcfe980ba99ab638088348e70d0 100644 (file)
@@ -334,6 +334,7 @@ void ib_destroy_fmr_pool(struct ib_fmr_pool *pool)
 {
        struct ib_pool_fmr *fmr;
        struct ib_pool_fmr *tmp;
+       LIST_HEAD(fmr_list);
        int                 i;
 
        kthread_stop(pool->thread);
@@ -341,6 +342,11 @@ void ib_destroy_fmr_pool(struct ib_fmr_pool *pool)
 
        i = 0;
        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);
                list_del(&fmr->list);
                kfree(fmr);