]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
rsocket: Index map item is cleaned before it is used in iomapping cleanup
authorSasha Kotchubievsky <sashakot@mellanox.com>
Thu, 4 Sep 2014 16:16:21 +0000 (09:16 -0700)
committerSean Hefty <sean.hefty@intel.com>
Thu, 4 Sep 2014 16:16:21 +0000 (09:16 -0700)
rs_free function clears index map item corresponding to the roscket
(in idm_clear called from rs_remove) and then uses it in
iomapping cleanup (in riounmap called from rs_free_iomappings).

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
src/rsocket.c

index 7007897b17012f6d6c107592845dc2b082ff7e4d..00d9a185bf01973b100e2c1ea2b41fc01a7882c2 100644 (file)
@@ -967,9 +967,6 @@ static void rs_free(struct rsocket *rs)
                return;
        }
 
-       if (rs->index >= 0)
-               rs_remove(rs);
-
        if (rs->rmsg)
                free(rs->rmsg);
 
@@ -998,6 +995,9 @@ static void rs_free(struct rsocket *rs)
                rdma_destroy_id(rs->cm_id);
        }
 
+       if (rs->index >= 0)
+               rs_remove(rs);
+
        fastlock_destroy(&rs->map_lock);
        fastlock_destroy(&rs->cq_wait_lock);
        fastlock_destroy(&rs->cq_lock);