Message ID | 6ba824c412e5535b70683676734bebf82a4f325f.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 10/31] rdma/siw: use >__siw_cep_terminate_upcall() for SIW_CM_WORK_MPATIMEOUT > >It's easier to have generic logic in just one place. > >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 | 31 >++++++++---------------------- > 1 file changed, 8 insertions(+), 23 deletions(-) > >diff --git a/drivers/infiniband/sw/siw/siw_cm.c >b/drivers/infiniband/sw/siw/siw_cm.c >index 5338be450285..d03c7a66c6d1 100644 >--- a/drivers/infiniband/sw/siw/siw_cm.c >+++ b/drivers/infiniband/sw/siw/siw_cm.c >@@ -1127,31 +1127,16 @@ static void siw_cm_work_handler(struct >work_struct *w) > break; > > case SIW_CM_WORK_MPATIMEOUT: >+ /* >+ * MPA request timed out: >+ * Hide any partially received private data and signal >+ * timeout >+ */ > cep->mpa_timer = NULL; >+ cep->mpa.hdr.params.pd_len = 0; >+ __siw_cep_terminate_upcall(cep, -ETIMEDOUT); > >- if (cep->state == SIW_EPSTATE_AWAIT_MPAREP) { >- /* >- * MPA request timed out: >- * Hide any partially received private data and signal >- * timeout >- */ >- cep->mpa.hdr.params.pd_len = 0; >- >- if (cep->cm_id) >- siw_cm_upcall(cep, IW_CM_EVENT_CONNECT_REPLY, >- -ETIMEDOUT); >- release_cep = 1; >- >- } else if (cep->state == SIW_EPSTATE_AWAIT_MPAREQ) { >- /* >- * No MPA request received after peer TCP stream setup. >- */ >- if (cep->listen_cep) { >- siw_cep_put(cep->listen_cep); >- cep->listen_cep = NULL; >- } >- release_cep = 1; >- } >+ release_cep = 1; > break; > > default: >-- >2.25.1 > > Okay.
diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c index 5338be450285..d03c7a66c6d1 100644 --- a/drivers/infiniband/sw/siw/siw_cm.c +++ b/drivers/infiniband/sw/siw/siw_cm.c @@ -1127,31 +1127,16 @@ static void siw_cm_work_handler(struct work_struct *w) break; case SIW_CM_WORK_MPATIMEOUT: + /* + * MPA request timed out: + * Hide any partially received private data and signal + * timeout + */ cep->mpa_timer = NULL; + cep->mpa.hdr.params.pd_len = 0; + __siw_cep_terminate_upcall(cep, -ETIMEDOUT); - if (cep->state == SIW_EPSTATE_AWAIT_MPAREP) { - /* - * MPA request timed out: - * Hide any partially received private data and signal - * timeout - */ - cep->mpa.hdr.params.pd_len = 0; - - if (cep->cm_id) - siw_cm_upcall(cep, IW_CM_EVENT_CONNECT_REPLY, - -ETIMEDOUT); - release_cep = 1; - - } else if (cep->state == SIW_EPSTATE_AWAIT_MPAREQ) { - /* - * No MPA request received after peer TCP stream setup. - */ - if (cep->listen_cep) { - siw_cep_put(cep->listen_cep); - cep->listen_cep = NULL; - } - release_cep = 1; - } + release_cep = 1; break; default:
It's easier to have generic logic in just one place. 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 | 31 ++++++++---------------------- 1 file changed, 8 insertions(+), 23 deletions(-)