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=1796477784; b=vGDeVm5U90lXH31wZbRdrpeDdMjXmAnU06/MPVfkPgJ2JXqKgyCGq1xFm33NuOqvi1Db T1zmd9v3DjZWLrwkoqmp4oqkZivwd/vIHl+o3nkZfQt3zKpk14edhXkusYP3NWlEPhXn5 qfjbBNZXIQr3PimkGsfF4p4R2qFVc7CrJBZzu0lv8bjEoVi18jgnh5ocBDvgViywQcfTY 9JoVdAIrdCKyOYSOvxLZOP9iSCDEIW232GyhXH0knezll7NKoba9rtk/qZP1cV6OD2fvX aE6fK5uDTomaMt+kupupEKGtGfjNErxQlrTXh885ryW9nsz8jrdKBoO9roAw2zF5hOA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796477784; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=LAf3n3VCQRh+re/apG+1bL4LuIsWIPNDR9dj/gWc7FY=; b=nLCZmtgSYouTxRhhSDT06HbcjHBz5UHz0uClTNVM4QdmNudqr57R6JUKP0DGxZVoJDnz M1RblQ0W0kbdB0/fR5o36lhh9b1qSdqyEEN5gshs6cM0Ya73gEzVo9tF6tM/khBvjXabn CHQxQBc7NQOUPHhl/kY7kHUucQHBojR0E4Ow+qWXelw62VusVdnhR0jrFoM9m9wm1I7M/ +h7Gyo6M1U92dWHvYr6wqFHCvb5iu8J4wxFBZBTpuGVvWEdbpQF3fjKyLi5iHXQQU706m uuh2c4j1qOSitdGUxVQClYrvkaYfH6OLhlzsYm0LYg88z8O8wMFGi4QCIXIawcfSYNg== 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=DxuGCUwH; 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 BE1F8606A322 for ; Sat, 5 Dec 2026 13:36:24 +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=DxuGCUwH Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F55E1F00A07; Sat, 5 Dec 2026 13:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796477784; bh=LAf3n3VCQRh+re/apG+1bL4LuIsWIPNDR9dj/gWc7FY=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=DxuGCUwH83cJ/7sifaN2DmSeB9oYsO1laGFlrxy1cyCPi64ETX/1f1CifgI2ku1Yp DyLl5B0oVVNtlhHip8TJUPXuWeaEw40/3SaHwdatpA1OHqnlURBTGTxI/VXesbx6DE RpbEWGa1Tj+utdR0ceW7K7C8oyf2DX+RF/1clhxAjIXtmn13OarS8HGyKDsQZPR3Gn G/c2Hjj0WDJrQqOHR2LSX5gRa8IKw6r64qFGjiRGDQ6KAzfGtJSf2KoUUUV9AeJzZa 6H5hbAQKow5SzS3AY9PDkSnVuPsYbAXbIKacGq8aRUtKNs5wCTM71V0tlvXW/6EWuU xmIM24reiJOag== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH can-next v6 11/24] can: isotp: reject reserved STmin values in CAN_ISOTP_RECV_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-11-9d42c52a90df@hartkopp.net> References: <20261205-getsockopt-memcg-isotp-v6-0-9d42c52a90df@hartkopp.net> <20261205-getsockopt-memcg-isotp-v6-11-9d42c52a90df@hartkopp.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 13:36:23 +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: - [High] can: isotp: isotp_setsockopt_locked() breaks documented STmin UAPI contract -- commit e411f95ace9edaf2da83a5a7f6bcf6411de8b25e Author: Oliver Hartkopp can: isotp: reject reserved STmin values in CAN_ISOTP_RECV_FC This commit rejects ISO 15765-2 reserved STmin values (0x80 - 0xF0 and 0xFA - 0xFF) with -EINVAL in the CAN_ISOTP_RECV_FC socket option, and updates the uAPI header comment and documentation accordingly. [ ... ] > diff --git a/include/uapi/linux/can/isotp.h b/include/uapi/linux/can/isot= p.h > index 7f9fb59bad71c..8b1cf7cc68ca0 100644 > --- a/include/uapi/linux/can/isotp.h > +++ b/include/uapi/linux/can/isotp.h > @@ -154,10 +154,9 @@ struct can_isotp_ll_options { > * > * We can strongly assume, that the Linux Kernel implementation of > * CAN_ISOTP is capable to run with BS=3D0, STmin=3D0 and WFTmax=3D0. > - * But as we like to be able to behave as a commonly available ECU, > - * these default settings can be changed via sockopts. > - * For that reason the STmin value is intentionally _not_ checked for > - * consistency and copied directly into the flow control (FC) frame. > + * These default settings can be changed with the CAN_ISOTP_RECV_FC > + * sockopt to behave like other ECUs. The reserved STmin values are > + * rejected with -EINVAL. > */ > =20 > /* link layer default values =3D> make use of Classical CAN frames */ > diff --git a/net/can/isotp.c b/net/can/isotp.c > index cea50bd78632d..01079ce4fa458 100644 > --- a/net/can/isotp.c > +++ b/net/can/isotp.c > @@ -1808,9 +1808,17 @@ static int isotp_setsockopt_locked(struct socket *= sock, int optname, > break; > } > =20 > - case CAN_ISOTP_RECV_FC: > - memcpy(&so->rxfc, val, sizeof(so->rxfc)); > + case CAN_ISOTP_RECV_FC: { > + const struct can_isotp_fc_options *fc =3D val; > + > + /* reject the reserved STmin values 0x80 - 0xF0, 0xFA - 0xFF */ > + if (fc->stmin > 0x7F && > + (fc->stmin < 0xF1 || fc->stmin > 0xF9)) > + return -EINVAL; > + > + memcpy(&so->rxfc, fc, sizeof(*fc)); > break; > + } > =20 > case CAN_ISOTP_TX_STMIN: > so->force_tx_stmin =3D *(const u32 *)val; [Severity: High] Does rejecting reserved STmin values in CAN_ISOTP_RECV_FC introduce a uAPI regression for existing userspace? Since commit e057dd3fc20f ("can: add ISO 15765-2:2016 transport protocol"), isotp.h has documented that stmin is intentionally unchecked and copied into flow control frames. Existing conformance tests and tools like isotprecv that configure reserved STmin values will now fail with -EINVAL. In the kernel, so->rxfc.stmin is only copied verbatim into the outgoing frame payload in isotp_send_fc() and read back via getsockopt. Accepting reserved values introduces no kernel timer, driver, or state-machine issue. CAN_RAW is also not a drop-in replacement for testing peer handling of reserved STmin values (such as clamping to 0x7F in isotp_rcv_fc()), since it lacks the ISO-TP RX state machine for flow control replies, blocksize counting, and consecutive frame reassembly. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205-getsockopt= -memcg-isotp-v6-0-9d42c52a90df@hartkopp.net?part=3D11