summaryrefslogtreecommitdiff
path: root/drivers/infiniband/ulp/srp/ib_srp.c
diff options
context:
space:
mode:
authorVu Pham <vu@mellanox.com>2006-11-22 01:14:10 +0300
committerRoland Dreier <rolandd@cisco.com>2006-11-30 02:33:09 +0300
commitd2fcea7d68473b8bb3e0addb4926c87e2217ca83 (patch)
treef0895261c6a063604837b9321315c896f4b5e8b8 /drivers/infiniband/ulp/srp/ib_srp.c
parent04699a1f8634a4e89c71b22050b599c72126fa96 (diff)
downloadlinux-d2fcea7d68473b8bb3e0addb4926c87e2217ca83.tar.xz
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>
Diffstat (limited to 'drivers/infiniband/ulp/srp/ib_srp.c')
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 613be2ef9c52..64ab5fc7cca3 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_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) {