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
Subject: Re: [PATCH can-next v3 6/6] can: bittiming: can_fixup_bittiming(): reject too high values for prop-seg/phase-seg1
Date: Wed, 02 Dec 2026 02:07:59 +0000 [thread overview]
Message-ID: <179617727910.3142.15270467182950792777@kernel.org> (raw)
In-Reply-To: <20261130-bittiming-fix-conversion-v3-6-e61f92dc76d0@pengutronix.de>
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 <mkl@pengutronix.de>
[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
prev parent reply other threads:[~2026-12-02 2:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 13:06 [PATCH can-next v3 0/6] can: bittiming: fix defects in the userspace bit rate conversion and reject invalid timing constants Marc Kleine-Budde
2026-11-30 13:06 ` [PATCH can-next v3 1/6] can: bittiming: can_calc_bittiming(): fix potential divide-by-zero Marc Kleine-Budde
2026-12-02 2:07 ` netdev-bot+sashiko
2026-11-30 13:06 ` [PATCH can-next v3 2/6] can: bittiming: can_calc_bittiming(): fix bitrate error calculation on unsigned operands Marc Kleine-Budde
2026-12-02 2:07 ` netdev-bot+sashiko
2026-11-30 13:06 ` [PATCH can-next v3 3/6] can: bittiming: can_update_sample_point(): fix sample point " Marc Kleine-Budde
2026-12-02 2:07 ` netdev-bot+sashiko
2026-11-30 13:06 ` [PATCH can-next v3 4/6] can: bittiming: register_candev(): reject unusable bit-timing constants Marc Kleine-Budde
2026-12-02 2:07 ` netdev-bot+sashiko
2026-11-30 13:06 ` [PATCH can-next v3 5/6] can: bittiming: can_bittiming_const_valid(): reject unusable BRP bit timing constant Marc Kleine-Budde
2026-12-02 2:07 ` netdev-bot+sashiko
2026-11-30 13:06 ` [PATCH can-next v3 6/6] can: bittiming: can_fixup_bittiming(): reject too high values for prop-seg/phase-seg1 Marc Kleine-Budde
2026-12-02 2:07 ` netdev-bot+sashiko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179617727910.3142.15270467182950792777@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=25031212351@stu.xidian.edu.cn \
--cc=byu@xidian.edu.cn \
--cc=davem@davemloft.net \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mkl@pengutronix.de \
--cc=socketcan@hartkopp.net \
--cc=stable@vger.kernel.org \
--cc=wencheng@xidian.edu.cn \
--cc=wg@grandegger.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox