Message ID | 3c43552c9b61a4d2352ae3680bfcacc25a9cc9b4.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:38AM >Cc: linux-rdma@vger.kernel.org, "Stefan Metzmacher" <metze@samba.org> >Subject: [EXTERNAL] [PATCH 16/31] rdma/siw: use error and out logic >at the end of siw_connect() > >This will make the following changes easier. > >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 | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) > >diff --git a/drivers/infiniband/sw/siw/siw_cm.c >b/drivers/infiniband/sw/siw/siw_cm.c >index 41d3436985a6..ec6d5c26fe22 100644 >--- a/drivers/infiniband/sw/siw/siw_cm.c >+++ b/drivers/infiniband/sw/siw/siw_cm.c >@@ -1539,14 +1539,19 @@ int siw_connect(struct iw_cm_id *id, struct >iw_cm_conn_param *params) > cep->mpa.pdata = NULL; > } > >- if (rv >= 0) { >- rv = siw_cm_queue_work(cep, SIW_CM_WORK_MPATIMEOUT); >- if (!rv) { >- siw_dbg_cep(cep, "[QP %u]: exit\n", qp_id(qp)); >- siw_cep_set_free(cep); >- return 0; >- } >+ if (rv < 0) { >+ 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; >+ > error: > siw_dbg(id->device, "failed: %d\n", rv); > >-- >2.25.1 > > Okay 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 41d3436985a6..ec6d5c26fe22 100644 --- a/drivers/infiniband/sw/siw/siw_cm.c +++ b/drivers/infiniband/sw/siw/siw_cm.c @@ -1539,14 +1539,19 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params) cep->mpa.pdata = NULL; } - if (rv >= 0) { - rv = siw_cm_queue_work(cep, SIW_CM_WORK_MPATIMEOUT); - if (!rv) { - siw_dbg_cep(cep, "[QP %u]: exit\n", qp_id(qp)); - siw_cep_set_free(cep); - return 0; - } + if (rv < 0) { + 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; + error: siw_dbg(id->device, "failed: %d\n", rv);
This will make the following changes easier. 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 | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)