From: sashiko-bot@kernel.org
To: "Yehyeong Lee" <yhlee@isslab.korea.ac.kr>
Cc: "Alexander Gordeev" <agordeev@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>
Subject: Re: [PATCH net v5 3/3] net/smc: carry oversized SMC-Rv2 LLC messages in the queue entry
Date: Sun, 02 Aug 2026 09:42:57 +0000 [thread overview]
Message-ID: <20260802094259.034AB1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260801094208.1937951-4-yhlee@isslab.korea.ac.kr>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Remote DoS via memory leak of dynamically allocated `qentry` during LLC flow termination
--
--- Patch [3]: [PATCH net v5 3/3] net/smc: carry oversized SMC-Rv2 LLC messages in the queue entry ---
commit 55107205f45488de7fb2933646d94dc31343b612
Author: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
Subject: net/smc: carry oversized SMC-Rv2 LLC messages in the queue entry
This commit modifies how oversized SMC-Rv2 LLC messages are handled by
copying the tail of the message directly into the queue entry. It avoids
rebuilding the message layout in multiple consumers and bounds the
DELETE_RKEY_V2 processing by the actual message length that arrived.
> diff --git a/net/smc/smc_llc.c b/net/smc/smc_llc.c
> index c9bf938f1ee2a..ba60cc0f1690b 100644
> --- a/net/smc/smc_llc.c
> +++ b/net/smc/smc_llc.c
[ ... ]
> @@ -2083,18 +2098,35 @@ static void smc_llc_rx_response(struct smc_link *link,
> wake_up(&link->lgr->llc_msg_waiter);
> }
[Severity: High]
This is a pre-existing issue, but can this leak dynamically allocated qentry
objects?
If a peer sends a duplicate or delayed LLC response (like SMC_LLC_ADD_LINK)
while the local LLC flow is still active but after the local node has already
cleared flow->qentry, smc_llc_rx_response() will assign the newly allocated
qentry to flow->qentry via smc_llc_flow_qentry_set() without taking a lock:
net/smc/smc_llc.c:smc_llc_rx_response() {
...
assign:
/* assign responses to the local flow, we requested them */
smc_llc_flow_qentry_set(&link->lgr->llc_flow_lcl, qentry);
wake_up(&link->lgr->llc_msg_waiter);
}
When the flow eventually terminates, smc_llc_flow_stop() clears the flow:
net/smc/smc_llc.c:smc_llc_flow_stop() {
...
spin_lock_bh(&lgr->llc_flow_lock);
memset(flow, 0, sizeof(*flow));
...
}
This memset() erases the flow->qentry pointer without calling kfree(),
permanently leaking the buffer. Could this allow a remote peer to cause OOM
by intentionally sending delayed or duplicate responses?
> -static void smc_llc_enqueue(struct smc_link *link, union smc_llc_msg *llc)
> +static void smc_llc_enqueue(struct smc_link *link, union smc_llc_msg *llc,
> + u32 byte_len)
> {
> struct smc_link_group *lgr = link->lgr;
> struct smc_llc_qentry *qentry;
> unsigned long flags;
> + u16 body_len = 0;
>
> - qentry = kmalloc_obj(*qentry, GFP_ATOMIC);
> + /* V2 messages can be longer than the inline union smc_llc_msg. Carry
> + * the remainder in the qentry itself, so that its lifetime and its
> + * length match the message the peer actually sent.
> + */
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260801094208.1937951-1-yhlee@isslab.korea.ac.kr?part=3
prev parent reply other threads:[~2026-08-02 9:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-01 9:42 [PATCH net v5 0/3] net/smc: fix out-of-bounds and use-after-free in SMC-Rv2 LLC processing Yehyeong Lee
2026-08-01 9:42 ` [PATCH net v5 1/3] net/smc: fix use-after-free of the LLC qentry in smc_llc_srv_add_link() Yehyeong Lee
2026-08-02 9:42 ` sashiko-bot
2026-08-01 9:42 ` [PATCH net v5 2/3] net/smc: bound the peer rkey counts in SMC-Rv2 LLC messages Yehyeong Lee
2026-08-02 9:42 ` sashiko-bot
2026-08-01 9:42 ` [PATCH net v5 3/3] net/smc: carry oversized SMC-Rv2 LLC messages in the queue entry Yehyeong Lee
2026-08-02 9:42 ` 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=20260802094259.034AB1F00A3A@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