Message ID | c81a993594cc8dca834b0bf5de960fac68093250.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 |
-----"Stefan Metzmacher" <metze@samba.org> wrote: ----- >To: "Bernard Metzler" <bmt@zurich.ibm.com> >From: "Stefan Metzmacher" <metze@samba.org> >Date: 05/07/2021 01:39AM >Cc: linux-rdma@vger.kernel.org, "Stefan Metzmacher" <metze@samba.org> >Subject: [EXTERNAL] [PATCH 17/31] rdma/siw: start mpa timer before >calling siw_send_mpareqrep() > >The mpa timer will also span the non-blocking connect >in the final patch. > >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 | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > >diff --git a/drivers/infiniband/sw/siw/siw_cm.c >b/drivers/infiniband/sw/siw/siw_cm.c >index ec6d5c26fe22..853b80fcb8b0 100644 >--- a/drivers/infiniband/sw/siw/siw_cm.c >+++ b/drivers/infiniband/sw/siw/siw_cm.c >@@ -1526,6 +1526,11 @@ int siw_connect(struct iw_cm_id *id, struct >iw_cm_conn_param *params) > } > cep->mpa.hdr.params.pd_len = pd_len; > >+ rv = siw_cm_queue_work(cep, SIW_CM_WORK_MPATIMEOUT); >+ if (rv != 0) { >+ goto error; >+ } >+ > cep->state = SIW_EPSTATE_AWAIT_MPAREP; > > rv = siw_send_mpareqrep(cep, cep->mpa.pdata, >@@ -1543,11 +1548,6 @@ int siw_connect(struct iw_cm_id *id, struct >iw_cm_conn_param *params) > goto error; > } > >- rv = siw_cm_queue_work(cep, SIW_CM_WORK_MPATIMEOUT); >- if (rv != 0) { >- goto error; >- } >- > siw_dbg_cep(cep, "[QP %u]: exit\n", qp_id(qp)); > siw_cep_set_free(cep); > return 0; >@@ -1556,6 +1556,8 @@ int siw_connect(struct iw_cm_id *id, struct >iw_cm_conn_param *params) > siw_dbg(id->device, "failed: %d\n", rv); > > if (cep) { >+ siw_cancel_mpatimer(cep); >+ > siw_socket_disassoc(s); > sock_release(s); > cep->sock = NULL; >-- >2.25.1 > > Makes sense if we have a non-blocking connect() Reviewed-by: Bernard Metzler <bmt@zurich.ibm.com>
diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c index ec6d5c26fe22..853b80fcb8b0 100644 --- a/drivers/infiniband/sw/siw/siw_cm.c +++ b/drivers/infiniband/sw/siw/siw_cm.c @@ -1526,6 +1526,11 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params) } cep->mpa.hdr.params.pd_len = pd_len; + rv = siw_cm_queue_work(cep, SIW_CM_WORK_MPATIMEOUT); + if (rv != 0) { + goto error; + } + cep->state = SIW_EPSTATE_AWAIT_MPAREP; rv = siw_send_mpareqrep(cep, cep->mpa.pdata, @@ -1543,11 +1548,6 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params) goto error; } - rv = siw_cm_queue_work(cep, SIW_CM_WORK_MPATIMEOUT); - if (rv != 0) { - goto error; - } - siw_dbg_cep(cep, "[QP %u]: exit\n", qp_id(qp)); siw_cep_set_free(cep); return 0; @@ -1556,6 +1556,8 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params) siw_dbg(id->device, "failed: %d\n", rv); if (cep) { + siw_cancel_mpatimer(cep); + siw_socket_disassoc(s); sock_release(s); cep->sock = NULL;
The mpa timer will also span the non-blocking connect in the final patch. 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 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)