From: sashiko-bot@kernel.org
To: "Bryam Vargas" <hexlabsecurity@proton.me>
Cc: linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH net v3 4/7] net/smc: fix the failover catch-up across the cursor wrap rollover
Date: Fri, 04 Dec 2026 09:15:20 +0000 [thread overview]
Message-ID: <sashiko-outbox-249476@kernel.org> (raw)
In-Reply-To: <20261203-b4-disp-ba1ad55e-v3-4-6834ff90c5d0@proton.me>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] net/smc: 32-bit overflow in smc_curs_advance() on peer-inflated
cursor
--
commit 52e3a4c92279019fc58cd954b752fde02a52614b
Author: Bryam Vargas <hexlabsecurity@proton.me>
net/smc: fix the failover catch-up across the cursor wrap rollover
This commit replaces smc_curs_comp() and smc_curs_diff() in
smc_switch_cursor() with smc_curs_sdiff() bounded by tx_curs_prep, and adds
smc_curs_advance() to advance the peer RMB producer cursor across multiple
wraps during link failover.
> diff --git a/net/smc/smc_cdc.h b/net/smc/smc_cdc.h
> index 597acb2e123f5..4b586a20dfc2c 100644
> --- a/net/smc/smc_cdc.h
> +++ b/net/smc/smc_cdc.h
> @@ -97,6 +97,16 @@ static inline void smc_curs_add(int size, union smc_host_cursor *curs,
> }
> }
>
> +/* smc_curs_add() for a value that may span more than one ring */
> +static inline void smc_curs_advance(unsigned int size,
> + union smc_host_cursor *curs, u32 value)
> +{
> + u32 count = curs->count + value;
> +
> + curs->wrap += count / size;
> + curs->count = count % size;
> +}
> +
> /* Copy cursor src into tgt */
> static inline void smc_curs_copy(union smc_host_cursor *tgt,
> union smc_host_cursor *src,
[Severity: Low]
Can curs->count + value overflow 32 bits here?
When sndbuf_desc->len exceeds conn->peer_rmbe_size, a remote peer can send
unchecked cons updates to smc_cdc_msg_recv_action() that inflate
conn->peer_rmbe_space past peer_rmbe_size. Each send larger than
peer_rmbe_size then calls smc_curs_add() in smc_tx_advance_cursors().
Because smc_curs_add() subtracts peer_rmbe_size only once, repeated sends
walk local_tx_ctrl_fin.count up toward 2^32. If link failover runs
smc_switch_cursor() and passes that cursor to smc_curs_advance(), the 32-bit
addition wraps modulo 2^32.
For peer_rmbe_size >= 128KB, wrapping count drops 2^(32 - k) wraps (where
peer_rmbe_size is 2^k) and corrupts local_tx_ctrl_fin.wrap and
local_tx_ctrl.prod.wrap on that connection. Using u64 for count with
div_u64_rem() avoids the overflow.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-b4-disp-ba1ad55e-v3-0-6834ff90c5d0@proton.me?part=4
next prev parent reply other threads:[~2026-12-04 9:15 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 9:15 [PATCH net v3 0/7] net/smc: fix the failover cursor switch and wrap rollover Bryam Vargas via B4 Relay
2026-12-03 9:15 ` Bryam Vargas
2026-12-03 9:15 ` [PATCH net v3 1/7] net/smc: take the socket spinlock across the failover cursor switch Bryam Vargas via B4 Relay
2026-12-03 9:15 ` Bryam Vargas
2026-12-03 9:15 ` [PATCH net v3 2/7] net/smc: do not credit stale CDC completions after a link switch Bryam Vargas via B4 Relay
2026-12-03 9:15 ` Bryam Vargas
2026-12-04 9:15 ` sashiko-bot
2026-12-04 9:49 ` netdev-bot+sashiko
2026-12-03 9:15 ` [PATCH net v3 3/7] net/smc: store each cursor once in smc_switch_cursor() Bryam Vargas via B4 Relay
2026-12-03 9:15 ` Bryam Vargas
2026-12-04 9:15 ` sashiko-bot
2026-12-03 9:15 ` [PATCH net v3 4/7] net/smc: fix the failover catch-up across the cursor wrap rollover Bryam Vargas via B4 Relay
2026-12-03 9:15 ` Bryam Vargas
2026-12-04 9:15 ` sashiko-bot [this message]
2026-12-03 9:15 ` [PATCH net v3 5/7] net/smc: order the urgent mark " Bryam Vargas via B4 Relay
2026-12-03 9:15 ` Bryam Vargas
2026-12-04 9:15 ` sashiko-bot
2026-12-03 9:15 ` [PATCH net v3 6/7] net/smc: update the urgent state under the socket spinlock Bryam Vargas via B4 Relay
2026-12-03 9:15 ` Bryam Vargas
2026-12-04 9:15 ` sashiko-bot
2026-12-04 9:49 ` netdev-bot+sashiko
2026-12-03 9:15 ` [PATCH net v3 7/7] net/smc: skip the urgent byte when it is the next unread byte Bryam Vargas via B4 Relay
2026-12-03 9:15 ` Bryam Vargas
2026-12-04 9:49 ` netdev-bot+sashiko
2026-12-04 9:15 ` [PATCH net v3 0/7] net/smc: fix the failover cursor switch and wrap rollover 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=sashiko-outbox-249476@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=hexlabsecurity@proton.me \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-s390@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.