Re: [PATCH rdma-rc] RDMA/rxe: Zero the AtomicETH compare field in fetch-and-add requests

From: Zhu Yanjun

Date: Wed Nov 25 2026 - 21:33:12 EST


在 2026/11/25 5:26, Andrew Stellman 写道:
init_req_packet() fills the AtomicETH compare field for compare-and-swap
requests but leaves it unwritten for fetch-and-add requests. The field is
eight bytes in the transmitted packet.

With init_on_alloc=0, all 200 fetch-and-add requests captured between
two rxe devices had nonzero bytes in that field, including printable
text. After this change, all 200 had zero there. Compare-and-swap
requests sent their compare value before and after the change.

Set the unused compare field to zero when constructing fetch-and-add
requests.

The issue was found by Claude Opus 5.5 while checking rxe for other
unzeroed memory, as Zhu Yanjun asked in his review of the rxe_mmap_info
patch. The fix and this changelog were drafted with OpenAI GPT-6
(Codex) and reviewed by me.

Fixes: 8700e3e7c485 ("Soft RoCE driver")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Andrew Stellman <astellman@xxxxxxxxxxxxxxxxxxx>

Thanks a lot. I am fine with this commit.
Reviewed-by: Zhu Yanjun <yanjun.zhu@xxxxxxxxx>

Zhu Yanjun

---
A reproducer is available on request.

drivers/infiniband/sw/rxe/rxe_req.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
index 4f353abd76f5..a1e7fa48c665 100644
--- a/drivers/infiniband/sw/rxe/rxe_req.c
+++ b/drivers/infiniband/sw/rxe/rxe_req.c
@@ -483,6 +483,7 @@ static struct sk_buff *init_req_packet(struct rxe_qp *qp,
atmeth_set_comp(pkt, ibwr->wr.atomic.compare_add);
} else {
atmeth_set_swap_add(pkt, ibwr->wr.atomic.compare_add);
+ atmeth_set_comp(pkt, 0);
}
atmeth_set_rkey(pkt, ibwr->wr.atomic.rkey);
}