Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH rdma-rc] RDMA/rxe: Zero the AtomicETH compare field in fetch-and-add requests
@ 2026-11-25 13:26 Andrew Stellman
  2026-11-25 13:29 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Stellman @ 2026-11-25 13:26 UTC (permalink / raw)
  To: Zhu Yanjun
  Cc: Zhu Yanjun, Jason Gunthorpe, Leon Romanovsky, linux-rdma,
	linux-kernel

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@vger.kernel.org
Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
---
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);
 	}
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-25 13:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 13:26 [PATCH rdma-rc] RDMA/rxe: Zero the AtomicETH compare field in fetch-and-add requests Andrew Stellman
2026-11-25 13:29 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox