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=1796478077; b=A/fLB+uEnPb8oDzsnVGHRyP3TwoEGYqT8rGE0aU5AZlXqtOiRD3sDX6ZIjys4VxTZ03z X9Sp2wJwd81qS1/AiTTLmJrjbPyLKoEiLNqOCdTKjtz5O+A1CNHpL3ldnNyz+y47dfPw9 wOXUE2ROoXc75bWCbY2U5H/MqxEm0PcXU3CdwU0f8wyJ3I5Yc2Nke4vZ8OBkidUat5aeW qL29Rc4nXB/2Qoxdcr/Ts7KPwM0IqjclOffnu0degkQlonXiecUEycwkAE1CXeos9XQ7K 2h2jP03uJ5f7k64oe30nTf9I4ov4NBHpvn0qjd3PkKc8cUhG3a637VFh40ZpZWUCYoQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796478077; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=BgZA23e094dGvLWW09C02OAo97bg01nw+4KUGMRCqbQ=; b=r4Pg8FEJmO6wg4uL4Xb20icV8LUhK3wY9HV0xjPbfburJR1uhhfgT3CZOMBdsR1wb3Mv YgeJLe5/nt7EuxCHvHhCfFwwpOd6fa6VUyo77u6A1yAlnGbNqfs/fM+GXRxP3XF8Eqmc1 y6l9WwVqbyJx+bqiHNa3JyHuk/NnNTQrW7NH3/OKYyI20ySMjZV23aXDyoJb+WfIF7NEc 3zM3Sz7jwyFDgOSphDTWpO/d0t89rm0kedZ6tc2+DxxEg5nEh6w9mCLwJM5JnFwm8X/gS PCj5529Etup7GFeWRMpJ3sQJY4YLred1oYRmMOAFO/WXp0XqI3f2oxxsdC1twzi+dsw== 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=VRE0+Fhl; 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 1DF9F606A322 for ; Sat, 5 Dec 2026 13:41:16 +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=VRE0+Fhl Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D45D1F0092B; Sat, 5 Dec 2026 13:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796478076; bh=BgZA23e094dGvLWW09C02OAo97bg01nw+4KUGMRCqbQ=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=VRE0+FhlSOG/HUrBRwMK1c65m2nheVwpBZXug0UoHcNE0MhOhFW0U+75WAkXnMqcG YTcY/ruenM7V56LYyTn+FLHVmR2hPUKzsQE9Fu3ElitTRJAviaJh0VaaGTPd59rV5Z PsCD9ow9PKrISWDGWVERaINv7s/HpBlLtcm9e3K5b+3UnwErHKmjjzukfo6Gr2veIT 4NaYY3obhThKem/as7jzpZDlz2+qr6kyaa9rYNnUwOD9PTeJV2dMgT94guNsQ2I9Jr Yl/8CiVrrHqBdhkARknjQ5yUmpcmUOXAZODIL9TOE0Q79K/tpLdUTKFNuFQWdkIlmh oAGICP7p5yBQQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH can-next v6 09/24] can: isotp: add N_Ar timeout monitoring for FC Reply-To: sashiko-reviews@lists.linux.dev To: "Oliver Hartkopp" , linux-can@vger.kernel.org Cc: "Marc Kleine-Budde" , "Vincent Mailhol" , "Oleksij Rempel" In-Reply-To: <20261205-getsockopt-memcg-isotp-v6-9-9d42c52a90df@hartkopp.net> References: <20261205-getsockopt-memcg-isotp-v6-0-9d42c52a90df@hartkopp.net> <20261205-getsockopt-memcg-isotp-v6-9-9d42c52a90df@hartkopp.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 13:41:16 +0000 X-Mailing-List: linux-can@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] can: isotp: stale fcecho tag can hijack TX echo on UID wraparound -- commit db13776480d3beadbc91c0325a1b7fc5d7a67feb Author: Oliver Hartkopp can: isotp: add N_Ar timeout monitoring for FC This commit adds N_Ar timeout monitoring for flow control frames by tagging outgoing FC skbs with a uid in so->fcecho and starting the N_Cr watchdog in isotp_rcv_echo() when the local echo arrives. > diff --git a/net/can/isotp.c b/net/can/isotp.c > index 493bad6f9a6a4..a2817cf21cf0c 100644 > --- a/net/can/isotp.c > +++ b/net/can/isotp.c [ ... ] > @@ -1008,6 +1022,16 @@ static void isotp_rcv_echo(struct sk_buff *skb, vo= id *data) > */ > spin_lock(&so->rx_lock); > =20 > + /* the FC has been sent =3D> start the CF timeout (N_Cr) */ > + if (READ_ONCE(so->fcecho) =3D=3D csx->can_skb_uid) { > + WRITE_ONCE(so->fcecho, 0); > + if (READ_ONCE(so->rx.state) =3D=3D ISOTP_WAIT_DATA) > + hrtimer_start(&so->rxtimer, > + ktime_set(ISOTP_TIMEOUT, 0), > + HRTIMER_MODE_REL_SOFT); > + goto out_unlock; > + } > + > /* so->cfecho may since belong to a new transfer; recheck under lock */ > if (READ_ONCE(so->cfecho) !=3D csx->can_skb_uid) > goto out_unlock; [Severity: Low] Can a stale so->fcecho value hijack a later TX echo here? When can_send() fails in isotp_send_fc(), nskb is freed without an echo and so->fcecho remains non-zero. Because can_set_skb_uid() allocates 32-bit UIDs from the global skbcounter, wraparound can assign that same UID to a later TX frame on this socket. isotp_rcv_echo() checks so->fcecho before so->cfecho and jumps to out_unlock even when so->rx.state is ISOTP_IDLE, swallowing the TX echo and leaving so->echotimer to fail the transfer with -ECOMM. Clearing so->fcecho on can_send() failure and when so->rx.state returns to ISOTP_IDLE would prevent stale tags from matching. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205-getsockopt= -memcg-isotp-v6-0-9d42c52a90df@hartkopp.net?part=3D9