]> err.no Git - linux-2.6/commitdiff
IB/srp: Fix memory leak on reconnect
authorVu Pham <vu@mellanox.com>
Tue, 21 Nov 2006 22:14:10 +0000 (14:14 -0800)
committerRoland Dreier <rolandd@cisco.com>
Wed, 29 Nov 2006 23:33:09 +0000 (15:33 -0800)
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>
drivers/infiniband/ulp/srp/ib_srp.c

index 613be2ef9c5227d9580d394215d43007549d6031..64ab5fc7cca38db98ad503dbf4e8cf2a5fbd7eb3 100644 (file)
@@ -1176,9 +1176,11 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
                        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) {