Linux CAN drivers development
 help / color / mirror / Atom feed
* [PATCH can-next v3 00/23] can: memcg accounting, CAN_ISOTP fixes and cleanups
@ 2026-11-30 13:22 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
                   ` (22 more replies)
  0 siblings, 23 replies; 30+ messages in thread
From: Oliver Hartkopp @ 2026-11-30 13:22 UTC (permalink / raw)
  To: linux-can
  Cc: Marc Kleine-Budde, Oliver Hartkopp, Sashiko, Zihan Xi,
	Oleksij Rempel, Wentian Ye

Patches 1-3 are the remaining CAN patches of the former lock_sock() and
memcg series, whose first patches have been applied via the net tree.
They are followed by CAN_ISOTP fixes and cleanups that have been found
while preparing the CAN XL support for CAN_ISOTP.

Patches 1-2 read the CAN_RAW and CAN_ISOTP socket options under
conf_lock, so that a concurrent setsockopt() can not lead to a mix of
old and new values in getsockopt().

Patch 3 enables the memcg accounting for the CAN allocations that can
be triggered by unprivileged users (socket structures, receivers,
CAN_BCM ops and frames, CAN_RAW/J1939 filters, the CAN_ISOTP TX buffer
for large PDUs and the J1939 per device data).

Patch 4 fixes a CAN_ISOTP socket in listen mode that sent a FC.OVFLW on
the bus. It carries a Fixes tag and applies to net as well.

Patches 5-11 improve the CAN_ISOTP socket options and timing:
- check the CAN_ISOTP_OPTS values before applying them
- add the frame transmission time (N_As/N_Ar) to the CF broadcast gap
  and to the timeouts that are started with the transmission of a CAN
  frame and limit it to the N_As/N_Ar timeout
- use the N_As timeout of 1 s for the local echo
- reject undefined CAN FD tx_flags and reserved STmin values
- ignore CAN_ISOTP_CHK_PAD_DATA without CAN_ISOTP_RX_PADDING as
  documented

Patches 12-15 fix the CAN_ISOTP reception against ISO 15765-2:
- drop frames without N_PCI and FFs with an invalid length extension
- check FF_DLmin and the data length of the last CF

Patches 16-23 are cleanups in preparation of the CAN XL support for
CAN_ISOTP.

Patches 5-15 only affect invalid configurations and frames, tighten the
uAPI or adjust the timeouts and therefore do not carry Fixes tags.

Changes in v3:
- can: isotp: add the frame transmission time to the CF broadcast gap:
  explain the missing Fixes tag for the unit fix in iso15765-2.rst
- can: isotp: add the frame transmission time to the protocol timeouts:
  add frame_txtime to the CF echo timeouts as well
- new patch: can: isotp: use the N_As timeout for the local echo
  (1 s instead of 2 s, document ECOMM for the local echo timeout)
- can: isotp: reject reserved STmin values in CAN_ISOTP_RECV_FC:
  state the intentional uAPI tightening, update the remark in isotp.h,
  document the rejected values and fix the struct name in iso15765-2.rst
- can: isotp: drop frames without N_PCI: reworded commit message
- can: isotp: drop FF frames with invalid length extension: describe the
  impact and the reason for the missing Fixes tag
- can: isotp: rename rx_lock as it has become state machine lock:
  precise the locking comment for isotp_release()
- Link to v2: https://lore.kernel.org/linux-can/20261128-getsockopt-memcg-isotp-v2-0-034ba95e17a4@hartkopp.net/

Changes in v2:
- can: enable memcg accounting for user triggered allocations:
  added Acked-by from Oleksij Rempel
- can: isotp: do not send FC.OVFLW in listen mode:
  moved to patch 4, describe the impact on a correct listen mode
  configuration, add Fixes tag and Cc stable
- new patch: can: isotp: add the frame transmission time to the CF
  broadcast gap (also fixes the unit of the forced stmin values in
  iso15765-2.rst)
- can: isotp: add the frame transmission time to the protocol timeouts:
  limit frame_txtime to the N_As/N_Ar timeout of 1 s from ISO 15765-2
  instead of 100 ms, document the limit in isotp.h and iso15765-2.rst
- can: isotp: check the CAN FD tx_flags in CAN_ISOTP_LL_OPTS:
  state the intentional uAPI tightening, always set CANFD_FDF for
  CAN FD, document the accepted tx_flags
- can: isotp: reject CAN_ISOTP_CHK_PAD_DATA without CAN_ISOTP_RX_PADDING
  replaced by "can: isotp: ignore CAN_ISOTP_CHK_PAD_DATA without
  CAN_ISOTP_RX_PADDING" which fixes check_pad() as documented instead
  of rejecting the option
- can: isotp: drop frames without N_PCI, check the minimum FF_DL, check
  the data length of the last CF: describe the impact and the reason
  for the missing Fixes tag in the commit messages
- dropped: can: isotp: ignore invalid SF and FF frames during a reception
- can: isotp: rename rx_lock as it has become state machine lock:
  fixed typo in the subject, updated the locking comment in isotp_rcv()
- can: isotp: change return type of functions to void:
  removed the trailing return statements
- can: isotp: introduce CAN_ISOTP_MIN_TX_DL:
  use it only for TX_DL checks, separate block in isotp.h
- Link to v1: https://patch.msgid.link/20261126-getsockopt-memcg-isotp-v1-0-681ef8d8c2c9@hartkopp.net

---
Oliver Hartkopp (23):
      can: raw: read socket options under conf_lock in raw_getsockopt()
      can: isotp: read socket options under conf_lock in isotp_getsockopt()
      can: enable memcg accounting for user triggered allocations
      can: isotp: do not send FC.OVFLW in listen mode
      can: isotp: check the CAN_ISOTP_OPTS values before applying them
      can: isotp: add the frame transmission time to the CF broadcast gap
      can: isotp: add the frame transmission time to the protocol timeouts
      can: isotp: use the N_As timeout for the local echo
      can: isotp: check the CAN FD tx_flags in CAN_ISOTP_LL_OPTS
      can: isotp: reject reserved STmin values in CAN_ISOTP_RECV_FC
      can: isotp: ignore CAN_ISOTP_CHK_PAD_DATA without CAN_ISOTP_RX_PADDING
      can: isotp: drop frames without N_PCI
      can: isotp: drop FF frames with invalid length extension
      can: isotp: check the minimum FF_DL
      can: isotp: check the data length of the last CF
      can: isotp: drop inline keyword, let the compiler decide
      can: isotp: rename rx_lock as it has become state machine lock
      can: isotp: introduce isotp_invalid_canid() to verify proper CAN-IDs
      can: isotp: rename variable for the required content length
      can: isotp: rename checkpad functions returning bool values
      can: isotp: change return type of functions to void
      can: isotp: rename pointer in isotp_rcv() prototype
      can: isotp: introduce CAN_ISOTP_MIN_TX_DL

 Documentation/networking/iso15765-2.rst |  34 ++-
 include/uapi/linux/can/isotp.h          |  16 +-
 net/can/af_can.c                        |  12 +-
 net/can/bcm.c                           |  10 +-
 net/can/isotp.c                         | 372 ++++++++++++++++++--------------
 net/can/j1939/main.c                    |   2 +-
 net/can/j1939/socket.c                  |  12 +-
 net/can/raw.c                           |  78 ++++---
 8 files changed, 311 insertions(+), 225 deletions(-)
---
base-commit: e1055cbfd6eb578417f3ce983cf44462e8465267
change-id: 20261126-getsockopt-memcg-isotp-052433c7adda

Best regards,
--  
Oliver Hartkopp <socketcan@hartkopp.net>


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2026-12-02  7:44 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox