From: sashiko-bot@kernel.org
To: "Yonatan Nachum" <ynachum@amazon.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH for-rc v2] RDMA/efa: Fix race between admin command timeout and completion
Date: Mon, 12 Oct 2026 16:57:57 +0000 [thread overview]
Message-ID: <sashiko-outbox-168440@kernel.org> (raw)
In-Reply-To: <20261012165113.576899-1-ynachum@amazon.com>
> An admin command that times out can race with the interrupt handler
> processing its completion, in two ways.
>
> The timeout path releases the completion context without synchronizing
> against the handler. A handler that has already seen the command as
> submitted then copies the CQE into the caller's response buffer after
> the waiter returned and that buffer went out of scope.
>
> The waiter can also observe the command as completed before the CQE was
> copied, since the status is published first. It decodes its own
> uninitialized response buffer, returns success with garbage contents and
> leaks stack data to the caller. Both wait paths read the status without
> the CQ lock.
>
> Add a timed-out state and publish it under the CQ lock in both wait
> paths before returning, so the handler, which only completes commands in
> submitted state, cannot act on an abandoned context. In the interrupt
> wait path test the return value of the wait instead of the status: the
> handler signals the completion after copying the CQE, so a successful
> wait implies a valid response. Read the status in the polling wait path
> inside the critical section that drains the CQ, which also lets a
> completion arriving on the last iteration be honored instead of reported
> as a timeout.
>
> Fixes: 0420e542569b ("RDMA/efa: Implement functions that submit and complete admin commands")
> Reviewed-by: Michael Margolin <mrgolin@amazon.com>
> Reviewed-by: Tom Sela <tomsela@amazon.com>
> Signed-off-by: Yonatan Nachum <ynachum@amazon.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261012165113.576899-1-ynachum@amazon.com?part=1
next prev parent reply other threads:[~2026-10-12 16:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 16:51 [PATCH for-rc v2] RDMA/efa: Fix race between admin command timeout and completion Yonatan Nachum
2026-10-12 16:57 ` sashiko-bot [this message]
2026-10-13 10:53 ` Leon Romanovsky
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-168440@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=ynachum@amazon.com \
/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