Skip to content

Commit f6e26e1

Browse files
hz-chenggregkh
authored andcommitted
RDMA/siw: Fix duplicated reported IW_CM_EVENT_CONNECT_REPLY event
[ Upstream commit 3056fc6 ] If siw_recv_mpa_rr returns -EAGAIN, it means that the MPA reply hasn't been received completely, and should not report IW_CM_EVENT_CONNECT_REPLY in this case. This may trigger a call trace in iw_cm. A simple way to trigger this: server: ib_send_lat client: ib_send_lat -R <server_ip> The call trace looks like this: kernel BUG at drivers/infiniband/core/iwcm.c:894! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI <...> Workqueue: iw_cm_wq cm_work_handler [iw_cm] Call Trace: <TASK> cm_work_handler+0x1dd/0x370 [iw_cm] process_one_work+0x1e2/0x3b0 worker_thread+0x49/0x2e0 ? rescuer_thread+0x370/0x370 kthread+0xe5/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 </TASK> Fixes: 6c52fdc ("rdma/siw: connection management") Link: https://lore.kernel.org/r/dae34b5fd5c2ea2bd9744812c1d2653a34a94c67.1657706960.git.chengyou@linux.alibaba.com Signed-off-by: Cheng Xu <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 9fc44cf commit f6e26e1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/infiniband/sw/siw/siw_cm.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -725,11 +725,11 @@ static int siw_proc_mpareply(struct siw_cep *cep)
725725
enum mpa_v2_ctrl mpa_p2p_mode = MPA_V2_RDMA_NO_RTR;
726726

727727
rv = siw_recv_mpa_rr(cep);
728-
if (rv != -EAGAIN)
729-
siw_cancel_mpatimer(cep);
730728
if (rv)
731729
goto out_err;
732730

731+
siw_cancel_mpatimer(cep);
732+
733733
rep = &cep->mpa.hdr;
734734

735735
if (__mpa_rr_revision(rep->params.bits) > MPA_REVISION_2) {
@@ -895,7 +895,8 @@ static int siw_proc_mpareply(struct siw_cep *cep)
895895
}
896896

897897
out_err:
898-
siw_cm_upcall(cep, IW_CM_EVENT_CONNECT_REPLY, -EINVAL);
898+
if (rv != -EAGAIN)
899+
siw_cm_upcall(cep, IW_CM_EVENT_CONNECT_REPLY, -EINVAL);
899900

900901
return rv;
901902
}

0 commit comments

Comments
 (0)