diff mbox series

[28/31] rdma/siw: make use of __siw_cep_close() in siw_qp_cm_drop()

Message ID 728163975670504e4401f73dcd9d6d18b56d1ba0.1620343860.git.metze@samba.org (mailing list archive)
State Changes Requested
Headers show
Series rdma/siw: fix a lot of deadlocks and use after free bugs | expand

Commit Message

Stefan Metzmacher May 6, 2021, 11:36 p.m. UTC
Now that the logic is identical we better use the common function
in order to avoid future problems.

Fixes: 6c52fdc244b5 ("rdma/siw: connection management")
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Cc: Bernard Metzler <bmt@zurich.ibm.com>
Cc: linux-rdma@vger.kernel.org
---
 drivers/infiniband/sw/siw/siw_cm.c | 23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
index 9f9750237e75..d2b1c62177ea 100644
--- a/drivers/infiniband/sw/siw/siw_cm.c
+++ b/drivers/infiniband/sw/siw/siw_cm.c
@@ -542,28 +542,7 @@  void siw_qp_cm_drop(struct siw_qp *qp, int schedule)
 		siw_dbg_cep(cep, "immediate close, state %d\n", cep->state);
 
 		__siw_cep_terminate_upcall(cep, -EINVAL);
-
-		if (cep->cm_id) {
-			cep->cm_id->rem_ref(cep->cm_id);
-			cep->cm_id = NULL;
-		}
-		cep->state = SIW_EPSTATE_CLOSED;
-
-		if (cep->sock) {
-			siw_socket_disassoc(cep->sock);
-			/*
-			 * Immediately close socket
-			 */
-			sock_release(cep->sock);
-			cep->sock = NULL;
-		}
-		if (cep->qp) {
-			BUG_ON(cep->qp->cep != cep);
-			cep->qp->cep = NULL;
-			siw_qp_put(cep->qp);
-			cep->qp = NULL;
-			siw_cep_put(cep);
-		}
+		__siw_cep_close(cep);
 out:
 		siw_cep_set_free(cep);
 	}