All of lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: socketcan@hartkopp.net
Cc: linux-can@vger.kernel.org, mkl@pengutronix.de, kuba@kernel.org
Subject: Re: [PATCH can-next v3 14/23] can: isotp: check the minimum FF_DL
Date: Wed, 02 Dec 2026 03:48:57 +0000	[thread overview]
Message-ID: <179618333779.3142.2308186571518228389@kernel.org> (raw)
In-Reply-To: <20261130-getsockopt-memcg-isotp-v3-14-21d72c15ad1d@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 gets the old receive behaviour wrong for one
  of the two FF_DL cases it describes, and it does not mention an…

--

can: isotp: check the minimum FF_DL

This commit changes the FF_DL check in isotp_rcv_ff() so that a First
Frame is ignored when its FF_DL would fit into a Single Frame at the
sender's LL_DL, as ISO 15765-2 requires. FF_DL is now compared against
the maximum SF_DL, the same way isotp_sendmsg() does on the tx path.

> The rx check in isotp_rcv_ff() added a SF_DL escape offset for LL_DL > 8
> on the wrong side and only rejected FF_DL < LL_DL - ae - off - ff_pci_sz.
> So it did not even ensure that a CF is needed. It accepted FFs whose
> FF_DL fits into the FF itself (e.g. FF_DL 6 for LL_DL 8, FF_DL 61 and 62
> for LL_DL 64) and FFs whose FF_DL fits into a SF (e.g. FF_DL 7 for
> LL_DL 8). In both cases the receiver sent a FC and waited for a CF that
> a compliant sender never sends.

[Severity: Low]
Is "in both cases" accurate for the second case?

Take classic CAN (LL_DL 8) with FF_DL = 7 - ae. That is FF_DL 7 with
normal addressing, or FF_DL 6 with extended or mixed addressing. The FF
carries only 6 - ae payload bytes, so one more byte is still needed. A
lenient sender that segments such a PDU does send that CF.

The old check in isotp_rcv_ff() accepted this FF:

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

The 1-byte last CF then passed the short-CF check in isotp_rcv_cf(), and
the PDU was delivered to the socket:

	if (cf->len < so->rx.ll_dl) {
		/* this is only allowed for the last CF */
		if (so->rx.len - so->rx.idx > so->rx.ll_dl - ae - N_PCI_SZ)
			return 1;
	}

With this patch, sf_max is 8 - SF_PCI_SZ4 - ae = 7 - ae, so the FF is now
ignored:

	if (so->rx.len <= sf_max)
		return 1;

rx.state stays ISOTP_IDLE. isotp_rcv_cf() then silently drops the CF that
follows:

	if (READ_ONCE(so->rx.state) != ISOTP_WAIT_DATA)
		return 0;

Ignoring these FFs is correct under ISO 15765-2, since FF_DL is below
FF_DLmin. But this case did not hang before the patch. After the patch,
Linux no longer receives 7 - ae byte PDUs from such senders, which it
received before.

The hang described in the message only applies to FF_DLs that fit
entirely into the FF. That is 6 - ae on LL_DL 8, and ll_dl - 3 - ae to
ll_dl - 2 - ae on LL_DL > 8. For LL_DL > 8, sf_max equals the 12-bit FF
payload capacity, so the case that used to work only exists on LL_DL 8.

This stays true at the end of the series. The later commit "can: isotp:
introduce CAN_ISOTP_MIN_TX_DL" only replaces CAN_MAX_DLEN with
CAN_ISOTP_MIN_TX_DL (both are 8) in this check.

Could the commit message describe the FF_DL = 7 - ae case on LL_DL 8 as a
deliberate tightening that changes interoperability, instead of a
transfer that used to hang?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-getsockopt-memcg-isotp-v3-0-21d72c15ad1d%40hartkopp.net

  reply	other threads:[~2026-12-02  3:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 13:22 [PATCH can-next v3 00/23] can: memcg accounting, CAN_ISOTP fixes and cleanups Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 01/23] can: raw: read socket options under conf_lock in raw_getsockopt() Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 02/23] can: isotp: read socket options under conf_lock in isotp_getsockopt() Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 03/23] can: enable memcg accounting for user triggered allocations Oliver Hartkopp
2026-12-02  3:48   ` netdev-bot+sashiko
2026-12-02  7:44     ` Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 04/23] can: isotp: do not send FC.OVFLW in listen mode Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 05/23] can: isotp: check the CAN_ISOTP_OPTS values before applying them Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 06/23] can: isotp: add the frame transmission time to the CF broadcast gap Oliver Hartkopp
2026-12-02  3:48   ` netdev-bot+sashiko
2026-11-30 13:22 ` [PATCH can-next v3 07/23] can: isotp: add the frame transmission time to the protocol timeouts Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 08/23] can: isotp: use the N_As timeout for the local echo Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 09/23] can: isotp: check the CAN FD tx_flags in CAN_ISOTP_LL_OPTS Oliver Hartkopp
2026-12-02  3:48   ` netdev-bot+sashiko
2026-11-30 13:22 ` [PATCH can-next v3 10/23] can: isotp: reject reserved STmin values in CAN_ISOTP_RECV_FC Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 11/23] can: isotp: ignore CAN_ISOTP_CHK_PAD_DATA without CAN_ISOTP_RX_PADDING Oliver Hartkopp
2026-12-02  3:48   ` netdev-bot+sashiko
2026-11-30 13:22 ` [PATCH can-next v3 12/23] can: isotp: drop frames without N_PCI Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 13/23] can: isotp: drop FF frames with invalid length extension Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 14/23] can: isotp: check the minimum FF_DL Oliver Hartkopp
2026-12-02  3:48   ` netdev-bot+sashiko [this message]
2026-11-30 13:22 ` [PATCH can-next v3 15/23] can: isotp: check the data length of the last CF Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 16/23] can: isotp: drop inline keyword, let the compiler decide Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 17/23] can: isotp: rename rx_lock as it has become state machine lock Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 18/23] can: isotp: introduce isotp_invalid_canid() to verify proper CAN-IDs Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 19/23] can: isotp: rename variable for the required content length Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 20/23] can: isotp: rename checkpad functions returning bool values Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 21/23] can: isotp: change return type of functions to void Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 22/23] can: isotp: rename pointer in isotp_rcv() prototype Oliver Hartkopp
2026-11-30 13:22 ` [PATCH can-next v3 23/23] can: isotp: introduce CAN_ISOTP_MIN_TX_DL 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=179618333779.3142.2308186571518228389@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=socketcan@hartkopp.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.