[ofa-general] [PATCH] krping: free child_cm_id in all error cases

Pete Wyckoff pw at osc.edu
Sun Jul 6 07:40:31 PDT 2008


Found a problem in krping while testing a broken iwarp device.
Against git head.  Not exactly tested, but works on my hacked-up
older version of krping.

		-- Pete


Anytime after the server has received a CONNECT_REQUEST, the
child_cm_id exists and must be destroyed.  Fix error paths
to make sure this always happens, else the rdma_cm_id leaks
and devices can not be unloaded.

Signed-off-by: Pete Wyckoff <pw at osc.edu>
---
 krping.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/krping.c b/krping.c
index d8fcdf2..4a6c382 100644
--- a/krping.c
+++ b/krping.c
@@ -1589,7 +1589,7 @@ static void krping_run_server(struct krping_cb *cb)
 	ret = krping_setup_qp(cb, cb->child_cm_id);
 	if (ret) {
 		printk(KERN_ERR PFX "setup_qp failed: %d\n", ret);
-		return;
+		goto err0;
 	}
 
 	ret = krping_setup_buffers(cb);
@@ -1619,11 +1619,12 @@ static void krping_run_server(struct krping_cb *cb)
 	else
 		krping_test_server(cb);
 	rdma_disconnect(cb->child_cm_id);
-	rdma_destroy_id(cb->child_cm_id);
 err2:
 	krping_free_buffers(cb);
 err1:
 	krping_free_qp(cb);
+err0:
+	rdma_destroy_id(cb->child_cm_id);
 }
 
 static void krping_test_client(struct krping_cb *cb)
-- 
1.5.5.1




More information about the general mailing list