From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796375721; b=sWhqQ5OHjMPZOGvGTRO+/CZnO+RL64jm0TCKYl9IGioOzhSYbpu8tyc9xfDrjYfG62Rc hCRqITthx1RdAsbEKa7olpfRtNIlScKXzQiqlSTQGR/XKwWQhpLVg7tzBEO/kAkMtZGfK ELy3rutwN7GkdF6FjiFbi0aOQELvZroWpkk+H5C6SQKipXbFT6DRsLpZfg2h4wrcYUFwW GtmDb9uQUzdNGjaGHjXkhBpH4JC3OSS5wa+T5VARixqXEYIJtCg9XPy2ADo1H8HDlDE+5 L/yZDnCR4cmeVHihSKJTbkY1kAwDsNlwIJOb9e7YHwYlR9JYkIX4v/o/mcbykJQ409A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796375721; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=1MpS2fjfL2HDjntainOQ+1UKROf2YgJI8jXeJaqlR90=; b=J1i4ASajdnLjYkpfHNPTU/+x6XMJADCwx6aXwIPKjvJKGReIchEbdkJvT4jyDmMqqSJO tIR7ZlTGO9hAdmmHQcCokMdpXiXnr0SCqvadewN3chLAcu22NjE/UtFailjYIq596GTfZ ZYUKokEKTSj1el7LHea07ZIVPJIavthP2oA4u4BldI7tt+8gtf30hZlviN1s/2Bk5kWju KrN7ceBv9BaUeKMD/49YvyU1RSGmy5x0lAXhSW9jgIRnhSbjZ7C1Hdr02ZnmZzwXPg1R/ TSPSkFzKE1C5bOAEFTAiAX/DwRG0Xd53VIXmnlyVqmvJzJ7aiovKLom+vxkEwEsfk4w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=PnSlZkvm; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5713C606A336; Fri, 4 Dec 2026 09:15:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=PnSlZkvm Received: by smtp.kernel.org (Postfix) with ESMTPSA id C35721F00931; Fri, 4 Dec 2026 09:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796375721; bh=1MpS2fjfL2HDjntainOQ+1UKROf2YgJI8jXeJaqlR90=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=PnSlZkvmdN6uNo7K/dxKSrSOvx3RRWLpuhOWCHp/zRaZ94RzQ2Jq+bJJ0daH2j36a hG4dSMfyx+cYImbfh3SDx4hytfJ8KA49BSzeW5xjmJntr1Lv+Pbs1zYqG8lIBnnHmE nCptO4XJcLwv32joI2SxwQDLvOMyxH8zmIwfeg9RX0IoObusiW2aikejca72W0NebC +OBJtFxfIUqKy0vXyRWnbVywZCx5omnyGHgJFzWHnSurCC7T4EdEqGUzo8eJSJaReu ZCvh6YubjoL2tMV9j4qqA4JVUbEAkCQTFZzboz8ixnmPi8qL2Vq6qkcvBJbpTpCSH4 KliutWE7pWfMQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net v3 4/7] net/smc: fix the failover catch-up across the cursor wrap rollover Reply-To: sashiko-reviews@lists.linux.dev To: "Bryam Vargas" Cc: linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org, "Heiko Carstens" , "Vasily Gorbik" , "Alexander Gordeev" , "Christian Borntraeger" In-Reply-To: <20261203-b4-disp-ba1ad55e-v3-4-6834ff90c5d0@proton.me> References: <20261203-b4-disp-ba1ad55e-v3-0-6834ff90c5d0@proton.me> <20261203-b4-disp-ba1ad55e-v3-4-6834ff90c5d0@proton.me> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 09:15:20 +0000 X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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_ho= st_cursor *curs, > } > } > =20 > +/* 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 =3D curs->count + value; > + > + curs->wrap +=3D count / size; > + curs->count =3D 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 >=3D 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-b4-disp-ba= 1ad55e-v3-0-6834ff90c5d0@proton.me?part=3D4