RDMA/rtrs-clt: Don't WARN on unexpected info-response opcode
Subsystems (2)
PATCH 1/1 RDMA/rtrs-clt: Don't WARN on unexpected info-response opcode
The info-response receive is posted for a SEND. The completion opcode comes from the peer, so RDMA WRITE with Immediate is a legal WC on that WQE even though it violates the RTRS handshake.
WARN_ON(wc->opcode != IB_WC_RECV) treats that peer-controlled field as an internal invariant and panics with panic_on_warn. Treat a non-SEND completion as a handshake failure: log it and keep the existing CONNECTING_ERR cleanup.
--- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/infiniband/ulp/rtrs/rtrs-clt.c +6 -1
@@ -2514,7 +2514,12 @@ static void rtrs_clt_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc) ib_wc_status_msg(wc->status)); goto out; } -WARN_ON (wc->opcode !=IB_WC_RECV ); +if (wc->opcode !=IB_WC_RECV ) { +rtrs_err (clt_path->clt, +"Path info response has unexpected opcode %d\n" , + wc->opcode); + goto out; + }if (wc->byte_len <sizeof (*msg)) { rtrs_err(clt_path->clt, "Path info response is malformed: size %d\n",
---
base-commit: 93f51579e7df248780214094418f205253383cc5
change-id: 20260921-rtrs-fix-rtrs-clt-info-rsp-done-3e5d47cfdc44
Best regards,
Signature · 1 line
Quanye Yang <[email protected]>
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 11 lines
From: Quanye Yang <[email protected]>
The info-response receive is posted for a SEND. The completion opcode comes from the peer, so RDMA WRITE with Immediate is a legal WC on that WQE even though it violates the RTRS handshake.
WARN_ON(wc->opcode != IB_WC_RECV)treats that peer-controlled field as an internal invariant and panics withpanic_on_warn. Treat a non-SEND completion as a handshake failure: log it and keep the existingCONNECTING_ERRcleanup.
Quoted 4 lines
Fixes 6a98d71daea1 ("RDMA/rtrs: client: main functionality")Reported-by Farhad Alemi <[email protected]>Link https://lore.kernel.org/linux-rdma/CA+0ovCge-K+hcGHXZ4R3Ww5+cg159uxHBeVbKeUSLBRSMT8OWA@mail.gmail.com open hereSigned-off-by Quanye Yang <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/20260921-rtrs-fix-rtrs-clt-info-rsp-done-v1-1-c64281ed97c0@proton.me?part=1
Quoted 30 lines · On Tue, Sep 22, 2026 at 6:25 AM Quanye Yang via B4 Relay…
From: Quanye Yang <[email protected]>
The info-response receive is posted for a SEND. The completion opcode comes from the peer, so RDMA WRITE with Immediate is a legal WC on that WQE even though it violates the RTRS handshake.
WARN_ON(wc->opcode != IB_WC_RECV)treats that peer-controlled field as an internal invariant and panics withpanic_on_warn. Treat a non-SEND completion as a handshake failure: log it and keep the existingCONNECTING_ERRcleanup.Fixes 6a98d71daea1 ("RDMA/rtrs: client: main functionality")Reported-by Farhad Alemi <[email protected]>Link https://lore.kernel.org/linux-rdma/CA+0ovCge-K+hcGHXZ4R3Ww5+cg159uxHBeVbKeUSLBRSMT8OWA@mail.gmail.com open hereSigned-off-by Quanye Yang <[email protected]>--- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/infiniband/ulp/rtrs/rtrs-clt.c +1
-1@@ -2514,7 +2514,12 @@ static void rtrs_clt_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc) ib_wc_status_msg(wc->status)); goto out; } -WARN_ON (wc->opcode !=IB_WC_RECV ); +if (wc->opcode !=IB_WC_RECV ) {
drivers/infiniband/ulp/rtrs/rtrs-clt.c static void rtrs_clt_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc)
Quoted 10 lines
drivers/infiniband/ulp/rtrs/rtrs-clt.c +5
-1+rtrs_err (clt_path->clt, +"Path info response has unexpected opcode %d\n" , + wc->opcode); + goto out; + }if (wc->byte_len <sizeof (*msg)) { rtrs_err(clt_path->clt, "Path info response is malformed: size %d\n", ---
lgtm,
Quoted 8 lines
base-commit:
93f51579e7df248780214094418f205253383cc5
change-id: 20260921-rtrs-fix-rtrs-clt-info-rsp-done-3e5d47cfdc44Best regards,
--
Quanye Yang <[email protected]>
Quoted 11 lines · Quanye Yang
From: Quanye Yang <[email protected]>
The info-response receive is posted for a SEND. The completion opcode comes from the peer, so RDMA WRITE with Immediate is a legal WC on that WQE even though it violates the RTRS handshake.
WARN_ON(wc->opcode != IB_WC_RECV)treats that peer-controlled field as an internal invariant and panics withpanic_on_warn. Treat a non-SEND completion as a handshake failure: log it and keep the existingCONNECTING_ERRcleanup.
Quoted 8 lines
Fixes 6a98d71daea1 ("RDMA/rtrs: client: main functionality")Reported-by Farhad Alemi <[email protected]>Link https://lore.kernel.org/linux-rdma/CA+0ovCge-K+hcGHXZ4R3Ww5+cg159uxHBeVbKeUSLBRSMT8OWA@mail.gmail.com open hereSigned-off-by Quanye Yang <[email protected]>Reviewed-by Jack Wang <[email protected]>--- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
Applied to for-next
Thanks,
Jason