From: sashiko-bot@kernel.org
To: "Yehyeong Lee" <yhlee@isslab.korea.ac.kr>
Cc: linux-s390@vger.kernel.org, "Vasily Gorbik" <gor@linux.ibm.com>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>
Subject: Re: [PATCH net v2] net/smc: fix out-of-bounds read of rkey array in SMC-Rv2 LLC processing
Date: Sat, 25 Jul 2026 06:16:22 +0000 [thread overview]
Message-ID: <20260725061623.559701F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260724061606.433735-1-yhlee@isslab.korea.ac.kr>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Data Race and Use-After-Overwrite in Asynchronous LLC Message Processing
--
--- Patch [1]: [PATCH net v2] net/smc: fix out-of-bounds read of rkey array in SMC-Rv2 LLC processing ---
commit 63d9ad267ae12085da6001381c4f5b5b34c2bf73
Author: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
net/smc: fix out-of-bounds read of rkey array in SMC-Rv2 LLC processing
This commit fixes an out-of-bounds read when processing SMC-Rv2 LLC messages
with oversized rkey counts in the non-shared receive-buffer layout. It
addresses the issue by copying the message body into the shared wr_rx_buf_v2
in the receive handler before the per-WR buffer is reposted.
> diff --git a/net/smc/smc_llc.c b/net/smc/smc_llc.c
> index 954b2ff1815c2..84d8d9024efa3 100644
> --- a/net/smc/smc_llc.c
> +++ b/net/smc/smc_llc.c
[ ... ]
> @@ -2104,6 +2105,26 @@ static void smc_llc_rx_handler(struct ib_wc *wc, void *buf)
> } else {
> if (llc->raw.hdr.length_v2 < sizeof(*llc))
> return; /* invalid message */
> + /* For the non-shared v2 rxbuf layout the message body beyond
> + * SMC_WR_TX_SIZE lives only in the per-WR receive buffer, which
> + * is reposted as soon as this handler returns. The LLC event
> + * handlers run later from a work item and read the body from
> + * wr_rx_buf_v2, so copy it there now - only the body, mirroring
> + * the shared-rxbuf layout where the spillover SGE DMAs the body
> + * into wr_rx_buf_v2 + SMC_WR_TX_SIZE. The header is left to the
> + * handlers, which restore it from the per-qentry copy, so a later
> + * message reaching wr_rx_buf_v2 cannot clobber it. wr_rx_buf_v2
> + * only exists for SMC_V2 link groups, so the link-group version
> + * is checked (not just the wire llc_version) to avoid a NULL
> + * dereference on a v1 link group.
> + */
> + if (link->lgr->smc_version == SMC_V2 &&
> + !smc_link_shared_v2_rxbuf(link) &&
> + wc->byte_len > SMC_WR_TX_SIZE)
> + memcpy((u8 *)link->lgr->wr_rx_buf_v2 + SMC_WR_TX_SIZE,
> + (u8 *)llc + SMC_WR_TX_SIZE,
> + min_t(u32, wc->byte_len, SMC_WR_BUF_V2_SIZE) -
> + SMC_WR_TX_SIZE);
[Severity: Medium]
If a peer sends two oversized LLC messages in rapid succession, could this
memcpy() execute in the softirq handler while the first message is still
being processed by the smc_llc_event_work workqueue?
Since the workqueue reads from the same shared lgr->wr_rx_buf_v2 buffer:
smc_llc_rmt_delete_rkey() {
...
if (smc_rtoken_delete(link, llcv2->rkey[i]))
...
}
Does this code introduce a data race regression causing torn reads, potentially
leading to the processing of mixed or overwritten payloads?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260724061606.433735-1-yhlee@isslab.korea.ac.kr?part=1
next prev parent reply other threads:[~2026-07-25 6:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 6:16 [PATCH net v2] net/smc: fix out-of-bounds read of rkey array in SMC-Rv2 LLC processing Yehyeong Lee
2026-07-25 6:16 ` sashiko-bot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-07-23 9:40 [PATCH net] " Yehyeong Lee
2026-07-24 4:53 ` [PATCH net v2] " Yehyeong Lee
2026-07-25 4:53 ` sashiko-bot
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=20260725061623.559701F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yhlee@isslab.korea.ac.kr \
/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