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=1796308204; b=UHivuKh4MbRqeT1YFUzPLALK8MzQ5BFK3ty+GvJv1O0aks8fzRXGkOV8cQQ3CEIPNj01 fSoYET6Sm4HZqX1OZA9EQoURicftmGZtuCiwgRiawl1OjNOX+i0J6XDc9shuP9YWXpP3R tMZ+Q76gyNBN33yt12GnE1vlj/214Bp+QYQhrmCtr6UoLHFDKCyR1N5YB1Shf6/nhPtMp paEgkOdA15rgIQXxJ08/igo09LU0pC2gE9P/x36ne0Sn1s6dnN3U4nZmcg8Rkj1/qlJXO PBuS2aRJPR0EyW40odYgpHiH9gyvUR7DWVbiRM9jYaXi362e5tFbd9i9QiEQRTPGJ1Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796308204; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=7DGBvR7Nss1yOUuDyWFmVc7YhiaM+GJ4Z7fByqoRHeg=; b=loCgDm2bcLllSGBWse9/yoJ32/i6uj+HcCBoYnDUZe51VjrcKgZC+ZxnqvgcpmYs8gfo 7qQoxTEzUyTQ7QeRnNPds0jeO/gNu/zln4s0QVRwNVuBo7Hn8MJpTeRuQKMkrKp0qUPAY XQum/g7uOEWMsm4If5wolzkX+/XGMPNRRlpCIfU09SaGt4POQdN3x+qZOBuiz9ebDZnNV 1rVOiP8j33Fnz1yfCx0Pic4aAsvC/ND1Z5+IIbVBMhhBbqjI5TdfVmhie0yuHWQTuD1ZG ZdYjcxCv1OHuC8dC1zxvjQt9LxUvX++eivrjzb7ILtKwU/Nxdn4G+1Mp4AggHhHTH2A== 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=hO7jXSlT; 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 D2F14606A330 for ; Thu, 3 Dec 2026 14:30:04 +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=hO7jXSlT Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35C431F00899; Thu, 3 Dec 2026 14:30:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796308204; bh=7DGBvR7Nss1yOUuDyWFmVc7YhiaM+GJ4Z7fByqoRHeg=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=hO7jXSlToojlDOE1ZoG7tbRa3BR4zUC8hRBkVkxOBQjRs26gsA6m0wswq13hGSxyA EB3zoFQjiVVLqkUISeXBI0Rd9PBFPK9UmveQx0onOFHioruG7TWEpVVSrH7+vz/etP qzp413DeOyLMBKgtZDK8clIz2tlGM9sU7p2O522C7iptDOsdwcTHsFAFjTjd0um8AN lyou07TPNSTClWuOLd/BDKJZ586POk4wcg//V/TCZV3XPqj/NHNkf662VxTG/MlkFA DIj05Gw71n4MjsK+0qvKmvLHEAu4lG8NHtcx4tNocE22uIzrULAmNZGi325xdqPJqt AuRYqTAxcic3Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH can-next v5 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: <20261203-getsockopt-memcg-isotp-v5-9-bbe89b3d3b71@hartkopp.net> References: <20261203-getsockopt-memcg-isotp-v5-0-bbe89b3d3b71@hartkopp.net> <20261203-getsockopt-memcg-isotp-v5-9-bbe89b3d3b71@hartkopp.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 14:30:03 +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: - [Medium] can: isotp: stale fcecho not cleared on CF reception or RX reset/rebind -- commit f28e2274ffdadd35c075c422f297ad52017051b6 Author: Oliver Hartkopp can: isotp: add N_Ar timeout monitoring for FC This commit adds N_Ar transmission timeout monitoring for flow control frames by tagging each FC skb with a uid in so->fcecho and starting the N_Cr consecutive frame timeout when its local echo arrives in isotp_rcv_echo(). > diff --git a/net/can/isotp.c b/net/can/isotp.c > index 368e50bd82fd7..d1f98c8d5c851 100644 > --- a/net/can/isotp.c > +++ b/net/can/isotp.c [ ... ] > @@ -1008,6 +1016,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: Medium] Can a delayed FC local echo spuriously restart so->rxtimer because so->fcecho is never cleared on CF reception? When a consecutive frame reaches isotp_rcv_cf() before the local echo of the preceding FC reaches isotp_rcv_echo(), isotp_rcv_cf() accepts the CF and restarts so->rxtimer for the next CF, but leaves so->fcecho set (unlike isotp_rcv_fc(), which clears so->cfecho when a FC arrives early). When the delayed FC echo later arrives while so->rx.state is still ISOTP_WAIT_DATA (for example when rxfc.bs is 0 or rx.bs < rxfc.bs), isotp_rcv_echo() matches the stale so->fcecho and restarts so->rxtimer for another full second, extending N_Cr past 1 s from the last CF. so->fcecho is also never cleared on RX resets to ISOTP_IDLE (isotp_rcv_sf(), isotp_rcv_ff(), or isotp_rcv_cf()) or in isotp_bind() (which clears so->cfecho), so an earlier FC echo can re-arm so->rxtimer during a later reception if isotp_send_fc() returns early. Clearing so->fcecho in isotp_rcv_cf() when stopping so->rxtimer, on RX resets to ISOTP_IDLE, and in isotp_bind() would prevent stale FC echoes from re-arming so->rxtimer. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-getsockopt= -memcg-isotp-v5-0-bbe89b3d3b71@hartkopp.net?part=3D9