Linux CAN drivers development
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: socketcan@hartkopp.net
Cc: linux-can@vger.kernel.org, mkl@pengutronix.de,
	sashiko-bot@kernel.org, zihanx@nebusec.ai,
	o.rempel@pengutronix.de, yewentian395@gmail.com, kuba@kernel.org
Subject: Re: [PATCH can-next 11/22] can: isotp: check the minimum FF_DL
Date: Sat, 28 Nov 2026 10:20:19 +0000	[thread overview]
Message-ID: <179586121974.3131.16556762186745483612@kernel.org> (raw)
In-Reply-To: <20261126-getsockopt-memcg-isotp-v1-11-681ef8d8c2c9@hartkopp.net>

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 message for "can: isotp: check the minimum FF_DL"
  describes the old receive check in isotp_rcv_ff() (net/can/isotp.c)…
- [Low] "can: isotp: check the minimum FF_DL" fixes a receive-path
  protocol bug in isotp_rcv_ff() (net/can/isotp.c) but has no Fixes: tag.

--

can: isotp: check the minimum FF_DL

This commit replaces the FF_DL lower bound check in isotp_rcv_ff() with a
check against the maximum SF_DL for the sender LL_DL. A PDU that would fit
into a SF is then no longer accepted as a FF, which matches what
isotp_sendmsg() does on the tx path.

> ISO 15765-2 requires FF_DL >= FF_DLmin: a PDU that fits into a SF must
> not be segmented. The rx check only ensured that a CF is needed and
> contained a SF_DL escape offset for LL_DL > 8 which is only required on
> the tx side. So e.g. FF_DL 7 was accepted for LL_DL 8.

[Severity: Low]
Does this describe the old check accurately? This was the old check in
isotp_rcv_ff() in net/can/isotp.c:

    off = (so->rx.ll_dl > CAN_MAX_DLEN) ? 1 : 0;

    if (so->rx.len + ae + off + ff_pci_sz < so->rx.ll_dl)
        return 1;

It only rejected FF_DL < LL_DL - ae - off - ff_pci_sz. That means it did
not guarantee that a CF was needed.

For CAN CC (LL_DL 8, ae 0, off 0, FF_PCI_SZ12), only FF_DL < 6 was
rejected. FF_DL 6 was accepted even though the FF already carries all 6
bytes.

For CAN FD (LL_DL 64, ae 0, off 1), FF_DL 61 and 62 were accepted. The FF
copy loop is bounded by ll_dl, not rx.len:

    for (i = ae + ff_pci_sz; i < so->rx.ll_dl; i++)
        so->rx.buf[so->rx.idx++] = cf->data[i];

So for FF_DL 61 it copied 62 bytes and left rx.idx > rx.len.

In both cases the receiver still moved to ISOTP_WAIT_DATA and sent FC CTS
for a CF that a compliant sender never sends.

Could the commit message say that the old check also accepted FFs whose
whole FF_DL already fits into the FF? The FF_DL 7 at LL_DL 8 example
understates what was accepted. The code change itself looks correct.

> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>

[Severity: Low]
Should this have a Fixes: tag? Without this patch, kernels accept FFs below
FF_DLmin in isotp_rcv_ff(). They then arm the rx timer and send FC CTS on
the bus. ISO 15765-2 says such FFs should be ignored.

git blame shows that the replaced check and the off computation come from
the original isotp commit, so this tag might fit:

Fixes: e057dd3fc20f ("can: add ISO 15765-2:2016 transport protocol")

Without it, the stable trees won't pick this up.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126-getsockopt-memcg-isotp-v1-0-681ef8d8c2c9%40hartkopp.net

  reply	other threads:[~2026-11-28 10:20 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 21:05 [PATCH can-next 00/22] can: memcg accounting, CAN_ISOTP fixes and cleanups Oliver Hartkopp
2026-11-26 21:05 ` [PATCH can-next 01/22] can: raw: read socket options under conf_lock in raw_getsockopt() Oliver Hartkopp
2026-11-26 21:05 ` [PATCH can-next 02/22] can: isotp: read socket options under conf_lock in isotp_getsockopt() Oliver Hartkopp
2026-11-26 21:05 ` [PATCH can-next 03/22] can: enable memcg accounting for user triggered allocations Oliver Hartkopp
2026-11-27 10:08   ` Oliver Hartkopp
2026-11-27 11:50     ` Oleksij Rempel
2026-11-27 11:58       ` Oliver Hartkopp
2026-11-26 21:05 ` [PATCH can-next 04/22] can: isotp: check the CAN_ISOTP_OPTS values before applying them Oliver Hartkopp
2026-11-26 21:05 ` [PATCH can-next 05/22] can: isotp: add the frame transmission time to the protocol timeouts Oliver Hartkopp
2026-11-28 10:20   ` netdev-bot+sashiko
2026-11-26 21:05 ` [PATCH can-next 06/22] can: isotp: check the CAN FD tx_flags in CAN_ISOTP_LL_OPTS Oliver Hartkopp
2026-11-28 10:20   ` netdev-bot+sashiko
2026-11-26 21:05 ` [PATCH can-next 07/22] can: isotp: reject reserved STmin values in CAN_ISOTP_RECV_FC Oliver Hartkopp
2026-11-26 21:05 ` [PATCH can-next 08/22] can: isotp: reject CAN_ISOTP_CHK_PAD_DATA without CAN_ISOTP_RX_PADDING Oliver Hartkopp
2026-11-28 10:20   ` netdev-bot+sashiko
2026-11-26 21:05 ` [PATCH can-next 09/22] can: isotp: drop frames without N_PCI Oliver Hartkopp
2026-11-28 10:20   ` netdev-bot+sashiko
2026-11-26 21:05 ` [PATCH can-next 10/22] can: isotp: drop FF frames with invalid length extension Oliver Hartkopp
2026-11-26 21:05 ` [PATCH can-next 11/22] can: isotp: check the minimum FF_DL Oliver Hartkopp
2026-11-28 10:20   ` netdev-bot+sashiko [this message]
2026-11-26 21:05 ` [PATCH can-next 12/22] can: isotp: check the data length of the last CF Oliver Hartkopp
2026-11-28 10:20   ` netdev-bot+sashiko
2026-11-26 21:05 ` [PATCH can-next 13/22] can: isotp: do not send FC.OVFLW in listen mode Oliver Hartkopp
2026-11-28 10:20   ` netdev-bot+sashiko
2026-11-26 21:05 ` [PATCH can-next 14/22] can: isotp: ignore invalid SF and FF frames during a reception Oliver Hartkopp
2026-11-28 10:20   ` netdev-bot+sashiko
2026-11-26 21:05 ` [PATCH can-next 15/22] can: isotp: drop inline keyword, let the compiler decide Oliver Hartkopp
2026-11-26 21:05 ` [PATCH can-next 16/22] can: isotp: rename rx_lock as it has become state machine lock Oliver Hartkopp
2026-11-28 10:20   ` netdev-bot+sashiko
2026-11-26 21:05 ` [PATCH can-next 17/22] can: isotp: introduce isotp_invalid_canid() to verify proper CAN-IDs Oliver Hartkopp
2026-11-26 21:06 ` [PATCH can-next 18/22] can: isotp: rename variable for the required content length Oliver Hartkopp
2026-11-26 21:06 ` [PATCH can-next 19/22] can: isotp: rename checkpad functions returning bool values Oliver Hartkopp
2026-11-26 21:06 ` [PATCH can-next 20/22] can: isotp: change return type of functions to void Oliver Hartkopp
2026-11-28 10:20   ` netdev-bot+sashiko
2026-11-26 21:06 ` [PATCH can-next 21/22] can: isotp: rename pointer in isotp_rcv() prototype Oliver Hartkopp
2026-11-26 21:06 ` [PATCH can-next 22/22] can: isotp: introduce CAN_ISOTP_MIN_TX_DL Oliver Hartkopp
2026-11-28 10:20   ` netdev-bot+sashiko
2026-11-28 17:54 ` [PATCH can-next 00/22] can: memcg accounting, CAN_ISOTP fixes and cleanups Oliver Hartkopp

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=179586121974.3131.16556762186745483612@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=o.rempel@pengutronix.de \
    --cc=sashiko-bot@kernel.org \
    --cc=socketcan@hartkopp.net \
    --cc=yewentian395@gmail.com \
    --cc=zihanx@nebusec.ai \
    /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