Browse Source

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@mellanox.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Vu Pham 18 years ago
parent
commit
d2fcea7d68
1 changed files with 5 additions and 3 deletions
  1. 5 3
      drivers/infiniband/ulp/srp/ib_srp.c

+ 5 - 3
drivers/infiniband/ulp/srp/ib_srp.c

@@ -1176,9 +1176,11 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
 			break;
 			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);
 		qp_attr = kmalloc(sizeof *qp_attr, GFP_KERNEL);
 		if (!qp_attr) {
 		if (!qp_attr) {