[openib-general] [PATCH] IB/SRP - leaking memory,

Roland Dreier rdreier at cisco.com
Mon Nov 27 20:39:59 PST 2006


OK, I queued this for 2.6.20:

commit 2a1e368d956984d1ec0074e22a898f441e5dee24
Author: Vu Pham <vu at mellanox.com>
Date:   Tue Nov 21 14:14:10 2006 -0800

    IB/srp: Fix memory leak on reconnect
    
    SRP reallocates the IU buffers for tx_ring and rx_ring without freeing
    the old buffers when it reconnects to a target.  Fix this by keeping
    the old IU buffers around.
    
    Signed-off-by: Vu Pham <vu at mellanox.com>
    Signed-off-by: Roland Dreier <rolandd at cisco.com>

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 613be2e..64ab5fc 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1176,9 +1176,11 @@ static int srp_cm_handler(struct ib_cm_i
 			break;
 		}
 
-		target->status = srp_alloc_iu_bufs(target);
-		if (target->status)
-			break;
+		if (!target->rx_ring[0]) {
+			target->status = srp_alloc_iu_bufs(target);
+			if (target->status)
+				break;
+		}
 
 		qp_attr = kmalloc(sizeof *qp_attr, GFP_KERNEL);
 		if (!qp_attr) {




More information about the general mailing list