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=1796070308; b=KQc6gmdrLGTb3BgPECYEdQoBPCsOtG8E14Dl6e696kV02I8aKwdESqJc1S9DmCJEsPqi 0NQSicwg0+lCkyVep4n8kp5jgertarhSgMNSLvarG8BjJD0372l4VdZnPGlTxIgVmiFBG 9I/tLp1CheozCx9RKhSuUpJUhrFdFEMjbb/AsB7NCUatXLOXk8tjkvydBP2qXdVEztJq/ JTG3QLgEt/7SB8Bcml3UJBK2nGsjZ/nOooGCcdCU0KaeGa0vroh5iL7FVi/BXHeTuQFAM F7m/03tExJOntmOtm1q15qpabmiTggWqhRSTlQ3tZ3lffdqGLjZl8uEYhzcz2WpJSsQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796070308; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=Nkotb+M8CoEFNX14BWHu3UkbQ61nekrUBXLZt0aYhDA=; b=XYVk36uf9qiJuxQRqUCno+LIaY8SM9dF1frWrtd/+fUQFIugpB7hi2Qozaak85sB7UEi opN0Gw1L2OJtwwqZr5QlBw8PNtIMbZ3C4KPbgDspYbleuwQZT7j8sZG9DoZ2mftR7+YMQ jKFtDxjjVKnv034xB21j04RH7YObI1TKE6mVBONHfAiMbuv8Z8BDAtb6ps6Y82LLC/K7A faSNG6+ku61m+s+5ZaXyvYCL08SNIteUr1D1RIaPnoI3T8nMWoQvbYN0LplpX3V224i1b zO9R+4jIxOx4CrMmWu81JB7utma+pYDPvK67lmeoWFdZcEXlm12ks1RmOC6Ij+nbLtw== 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="N/ltoj4r"; 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 5E8F2606A31A for ; Mon, 30 Nov 2026 20:25:08 +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=N/ltoj4r Received: by smtp.kernel.org (Postfix) with ESMTPSA id B708F1F00896; Mon, 30 Nov 2026 20:25:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796070307; bh=Nkotb+M8CoEFNX14BWHu3UkbQ61nekrUBXLZt0aYhDA=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=N/ltoj4r9EBponM+pyeP8mp5gNDDvc+nFh0OIBexg2eQREItuumnCRGnR/fFTpOgn 7u4Gsnf7a79nM9Cj6dBhI9kGjG+XbI93fB9AnrE3wNihj6OdHPjBw1vdYUNb7nzg/+ e212NWY3Mqu5QVjeekx5k4o6Yv9uEXuyCgRHdzLF9wulJUq4RaIu6pnYzJj7n2ZbeT oomyJAJyvLDwjFQLv0Tj+trjVJD3rx5w3sC2lmR5CuYggc3CL1FSJBNBpsvKyELAvp 5mBTRWGKmUS8YF4j0tAQA52+kwy8r9QpC7FSvuf+NB3+rV8pBSjTi9I5ABHdyGNPaR //40SaEs4dPAA== Subject: Re: [PATCH can-next v2 09/22] can: isotp: reject reserved STmin values in CAN_ISOTP_RECV_FC From: netdev-bot+sashiko@kernel.org To: socketcan@hartkopp.net Cc: linux-can@vger.kernel.org, mkl@pengutronix.de, kuba@kernel.org Date: Mon, 30 Nov 2026 20:25:07 +0000 Message-ID: <179607030732.3142.6219909436645380074@kernel.org> In-Reply-To: <20261128-getsockopt-memcg-isotp-v2-9-034ba95e17a4@hartkopp.net> References: <20261128-getsockopt-memcg-isotp-v2-9-034ba95e17a4@hartkopp.net> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-can@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 2 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] The uAPI header now contradicts the code. - [Low] The commit message does not say that 'can: isotp: reject reserved STmin values in CAN_ISOTP_RECV_FC' changes the uAPI, and it does not… - [Low] The 'Flow Control options' section of Documentation/networking/iso15765-2.rst (lines 253-258) lists the… -- can: isotp: reject reserved STmin values in CAN_ISOTP_RECV_FC This patch makes setsockopt(CAN_ISOTP_RECV_FC) return -EINVAL when the STmin value is in one of the ISO 15765-2 reserved ranges, 0x80 - 0xF0 or 0xFA - 0xFF. Before this change, any value was accepted and sent on the bus in the receiver's flow control frames. > can: isotp: reject reserved STmin values in CAN_ISOTP_RECV_FC > > The STmin value of struct can_isotp_fc_options is sent in the flow > control frames of the receiver. ISO 15765-2 reserves the values 0x80 - > 0xF0 and 0xFA - 0xFF, but CAN_ISOTP_RECV_FC accepted any value and the > reserved values were sent on the bus. The sender side replaces received > reserved values with 0x7F already. > > Reject the reserved STmin values with -EINVAL before the options are > applied. [Severity: Low] Is this meant as a bug fix or as a deliberate tightening of the uAPI? The message calls the old behaviour a defect ("the reserved values were sent on the bus"). It has no Fixes: tag, and it gives no reason for leaving one out. The sibling patch in this series, "can: isotp: check the CAN FD tx_flags in CAN_ISOTP_LL_OPTS", says "This is an intentional tightening of the uAPI and no bug fix". It also names CAN_RAW as the fallback for testing. Could this commit message say the same kind of thing? It could also mention that the change reverses the "intentionally _not_ checked" behaviour documented in include/uapi/linux/can/isotp.h. Without that, stable/AUTOSEL handling is unclear. Users who set reserved STmin values on purpose also get no explanation and no alternative. > diff --git a/net/can/isotp.c b/net/can/isotp.c > index ea3790a855827..22bfc1c7b131f 100644 > --- a/net/can/isotp.c > +++ b/net/can/isotp.c > @@ -1770,9 +1770,17 @@ static int isotp_setsockopt_locked(struct socket *sock, int optname, > break; > } > > - case CAN_ISOTP_RECV_FC: > - memcpy(&so->rxfc, val, sizeof(so->rxfc)); > + case CAN_ISOTP_RECV_FC: { > + const struct can_isotp_fc_options *fc = val; > + > + /* reject the reserved STmin values 0x80 - 0xF0, 0xFA - 0xFF */ > + if (fc->stmin > 0x7F && > + (fc->stmin < 0xF1 || fc->stmin > 0xF9)) > + return -EINVAL; [Severity: Medium] Does this now contradict the uAPI header? The "Remark on CAN_ISOTP_DEFAULT_RECV_* values" block in include/uapi/linux/can/isotp.h still says: * 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. Before this patch, the value went straight into so->rxfc, and isotp_send_fc() put it on the bus: ncf->data[ae + 2] = so->rxfc.stmin; Now setsockopt(fd, SOL_CAN_ISOTP, CAN_ISOTP_RECV_FC, &fc, 3) with fc.stmin in 0x80 - 0xF0 or 0xFA - 0xFF fails with -EINVAL. It used to return 0. Because the whole option is rejected, bs and wftmax from the same call are not applied either. Some userspace may rely on the documented behaviour, for example ECU simulators or robustness tools that send reserved STmin values to check that the peer clamps them to 0x7F, as isotp_rcv_fc() does here. Is that break intended? If it is, should the header comment be updated in this patch? It is still unchanged at the end of the series, at "can: isotp: introduce CAN_ISOTP_MIN_TX_DL". [Severity: Low] Should Documentation/networking/iso15765-2.rst mention this new error return? Its "Flow Control options" section lists the stmin ranges and says only "(others are reserved)". It does not say that setsockopt() now rejects those values. The tx_flags entry in the same file does document its restriction: ``CANFD_FDF`` marker) can be set, other flags are rejected with ``-EINVAL``. The stmin entry is still unchanged at the end of the series. > + > + memcpy(&so->rxfc, fc, sizeof(*fc)); > break; > + } > > case CAN_ISOTP_TX_STMIN: > so->force_tx_stmin = *(const u32 *)val; -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261128-getsockopt-memcg-isotp-v2-0-034ba95e17a4%40hartkopp.net