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=1796177280; b=FUpYtpuv8fU7vJK/w16Ih0Kuz3l3wKsEWY1FWbMookyLvNBcvZjAZYCltuF27bMGBKLq bSgvSQxhmSW7e2Gmn35FXtSEx+CfWMYIIXFzJ0G1AZy1xc7Hmoc7xmn7r7kIuIXdvTULf JwPpze6tkf6z7hF1323vwn3IU4edm9uWJs0799oPBeOSHIi9SE0QKKW65aTN1617t4o2V Zf/CUXn5b1BJZuAawximabngma6kgjD0Vb5Lfzs87kRCGF+NFCSU51MeCHbiXOkcqrRI9 HC/PuB+qbaq7Mre13O1ew4fJp5RsA9jJDx9zepDbi4vauE62IYl7gG+RJYPRQPuCjsg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796177280; 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=WJ/GLG8t0x6P1Fp/olg1GI6JfGxGVJR1VhXjcXyijhk=; b=QrBEGAv3dVKhOKMvLUpCiYywCRh2zJYyUvPtlkRqFyEZdEiOkWq7Q+BrlvpArAB9ZhIg 2CZWGarats7O5kX/LxxhVKjjodwRqcTnxpxIFWKbqvdK5msa/Gqr8C4TJlOUlNIa94BuS O+S46hXelimVXwaePmql1NMGoSRW/pvPV+0uWTmmGro2bsw2s1vmZYfv5wuoDczr0kbzO rdKrlyjeXoBFY0qhvm8Bz12/RMlaGtQFatxuP/6ZH3hFwSzn0Qj+PRu/2N5iPpivTVFlF sTXZ//Jt3ZvdeYdPGJWDSN5Jvxy+5Vd/aPESG6J55G5zLwHEDqRgOU4Z6wC6+bn/8kg== 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=Kb6h0mhR; 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 78A68606A31A; Wed, 2 Dec 2026 02:08:00 +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=Kb6h0mhR Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EC131F00896; Wed, 2 Dec 2026 02:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796177280; bh=WJ/GLG8t0x6P1Fp/olg1GI6JfGxGVJR1VhXjcXyijhk=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Kb6h0mhR3UWK8/OLPguJGSP2grZulPARzW6tbBm+CbQ8V12JAuCjFd98vwF7X8Vfo CcKBXmectkxtPQ7M++UvjufL0AAOxVcYtzBqaB0h5WYiMkCdWLTJxEMsCbyo9zn15h SynO3lTt1C6muCvwALujKuiKYQYeHVpwgwERtWPrgAnt44aEIBRtla+beoCV7h1Ei+ dkIFe/8Ubfff8FHPNaN8i4pgsVmSsDcwS22dCdgcjhh9vj01x+pMmej1YZjLGsomVy OkTymA0BCF0rGm30sqbO6Ekojf5cUC0e4OH/bLnubyHJ3uXNqFG4xkfuhKhepYdPkS /qBfgtXbZZ1aA== Subject: Re: [PATCH can-next v3 6/6] can: bittiming: can_fixup_bittiming(): reject too high values for prop-seg/phase-seg1 From: netdev-bot+sashiko@kernel.org To: mkl@pengutronix.de Cc: mailhol@kernel.org, socketcan@hartkopp.net, wg@grandegger.com, davem@davemloft.net, kernel@pengutronix.de, linux-can@vger.kernel.org, 25031212351@stu.xidian.edu.cn, stable@vger.kernel.org, byu@xidian.edu.cn, wencheng@xidian.edu.cn, kuba@kernel.org Date: Wed, 02 Dec 2026 02:07:59 +0000 Message-ID: <179617727910.3142.15270467182950792777@kernel.org> In-Reply-To: <20261130-bittiming-fix-conversion-v3-6-e61f92dc76d0@pengutronix.de> References: <20261130-bittiming-fix-conversion-v3-6-e61f92dc76d0@pengutronix.de> X-sashiko-severity: Low 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 more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The commit fixes an unsigned wrap in can_fixup_bittiming() (drivers/net/can/dev/bittiming.c) that user space can trigger. -- can: bittiming: can_fixup_bittiming(): reject too high values for prop-seg/phase-seg1 This commit replaces the unchecked prop_seg + phase_seg1 sum in can_fixup_bittiming() in drivers/net/can/dev/bittiming.c with check_add_overflow(). User supplied values whose sum wraps around can then no longer pass the tseg1_min and tseg1_max checks. Closes: https://sashiko.dev/#/bug/linux-afe8ea64-0e1f-42a4-a82c-6275ddeeaebc > Closes: https://sashiko.dev/#/bug/linux-afe8ea64-0e1f-42a4-a82c-6275ddeeaebc > Signed-off-by: Marc Kleine-Budde [Severity: Low] Should this commit carry Fixes: and Cc: stable tags? The unchecked sum dates back to the original CAN netlink interface in 39549eef3587 ("can: CAN Network device driver and Netlink interface"), where drivers/net/can/dev.c did: tseg1 = bt->prop_seg + bt->phase_seg1; Both values come straight from user space. can_changelink() in drivers/net/can/dev/netlink.c copies IFLA_CAN_BITTIMING unchanged: memcpy(&bt, nla_data(data[IFLA_CAN_BITTIMING]), sizeof(bt)); can_dbt_changelink() does the same for the data bit timing. The only validation is can_get_bittiming()->can_fixup_bittiming(). Take prop_seg = 0xFFFFFFFF and phase_seg1 = tseg1_min + 1. The sum wraps to tseg1_min and passes both tseg1 checks. The sjw checks only look at phase_seg1 and phase_seg2, so they pass too. The bogus prop_seg is then stored in priv->bittiming and passed to the driver's do_set_bittiming(). It is also reported back to user space, and the request succeeds instead of returning -EINVAL. Other patches in this series that fix the same kind of IFLA_CAN_BITTIMING overflow carry these tags. One example is "can: bittiming: can_calc_bittiming(): fix potential divide-by-zero": Fixes: 39549eef3587 ("can: CAN Network device driver and Netlink interface") Cc: stable@vger.kernel.org Without them, stable kernels will not pick up this fix automatically. Could the commit message also say what happens without the fix? An out-of-range prop_seg is accepted and programmed into the controller. -- Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-bittiming-fix-conversion-v3-0-e61f92dc76d0%40pengutronix.de