Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andrew Stellman" <astellman@stellman-greene.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-rc] RDMA/rxe: Fail ATOMIC_WRITE WQEs whose length is not 8 bytes
Date: Mon, 23 Nov 2026 14:19:31 +0000	[thread overview]
Message-ID: <sashiko-outbox-229387@kernel.org> (raw)
In-Reply-To: <20261123140625.64448-1-astellman@stellman-greene.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] RDMA/rxe: unreachable atomic write length check in
  rxe_requester()
--

commit 53a7ca51888beabddbfd557ad8447b0102b0d59e
Author: Andrew Stellman <astellman@stellman-greene.com>

RDMA/rxe: Fail ATOMIC_WRITE WQEs whose length is not 8 bytes

This commit adds a check in rxe_requester() to fail IB_WR_ATOMIC_WRITE
WQEs with IB_WC_LOC_QP_OP_ERR when the payload length is not sizeof(u64).

> diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
> index 6e01fb18893bf..962aef824ccc2 100644
> --- a/drivers/infiniband/sw/rxe/rxe_req.c
> +++ b/drivers/infiniband/sw/rxe/rxe_req.c
> @@ -824,6 +824,11 @@ int rxe_requester(struct rxe_qp *qp)
>  	mtu = get_mtu(qp);
>  	payload = (mask & (RXE_WRITE_OR_SEND_MASK | RXE_ATOMIC_WRITE_MASK)) ?
>  			wqe->dma.resid : 0;
> +	/* use the local copies: a user QP's WQE can change under us */
> +	if ((mask & RXE_ATOMIC_WRITE_MASK) && payload != sizeof(u64)) {
> +		wqe->status = IB_WC_LOC_QP_OP_ERR;
> +		goto err;
> +	}

[Severity: Medium]
Can payload ever differ from sizeof(u64) here when RXE_ATOMIC_WRITE_MASK
is set?

Earlier in rxe_requester(), req_next_wqe() copies the WQE into the
kernel-private buffer qp->req.send_wqe.wqe and forces wqe->dma.resid to
sizeof(u64) for atomic writes (added in a668a8564748 ("RDMA/rxe: copy
send WQE to kernel buffer before processing")):

drivers/infiniband/sw/rxe/rxe_req.c:req_next_wqe() {
    ...
	if (unlikely((wqe->mask & WR_ATOMIC_WRITE_MASK) &&
		     wqe->dma.resid != sizeof(u64)))
		wqe->dma.resid = sizeof(u64);
	return wqe;
}

As a result, this new check is unreachable, and an IB_WR_ATOMIC_WRITE WQE
with wqe->dma.resid != sizeof(u64) will still be clamped and sent as an
8-byte atomic write instead of failing with IB_WC_LOC_QP_OP_ERR.

Also, because this check runs after check_init_depth(), if the clamping in
req_next_wqe() is removed, a malformed atomic write WQE would consume or
stall on rd_atomic credits before failing.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123140625.64448-1-astellman@stellman-greene.com?part=1

      reply	other threads:[~2026-11-23 14:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 14:06 [PATCH rdma-rc] RDMA/rxe: Fail ATOMIC_WRITE WQEs whose length is not 8 bytes Andrew Stellman
2026-11-23 14:19 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-229387@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=astellman@stellman-greene.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox