Linux CAN drivers development
 help / color / mirror / Atom feed
* [PATCH can-next v2 00/22] can: memcg accounting, CAN_ISOTP fixes and cleanups
@ 2026-11-28 17:48 Oliver Hartkopp
  2026-11-28 17:48 ` [PATCH can-next v2 01/22] can: raw: read socket options under conf_lock in raw_getsockopt() Oliver Hartkopp
                   ` (22 more replies)
  0 siblings, 23 replies; 32+ messages in thread
From: Oliver Hartkopp @ 2026-11-28 17:48 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-10 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 protocol timeouts and limit it to the N_As/N_Ar timeout
- reject undefined CAN FD tx_flags and reserved STmin values
- ignore CAN_ISOTP_CHK_PAD_DATA without CAN_ISOTP_RX_PADDING as
  documented

Patches 11-14 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 15-22 are cleanups in preparation of the CAN XL support for
CAN_ISOTP.

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

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 (22):
      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: 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 |  27 ++-
 include/uapi/linux/can/isotp.h          |   9 +-
 net/can/af_can.c                        |  12 +-
 net/can/bcm.c                           |  10 +-
 net/can/isotp.c                         | 346 ++++++++++++++++++--------------
 net/can/j1939/main.c                    |   2 +-
 net/can/j1939/socket.c                  |  12 +-
 net/can/raw.c                           |  78 +++----
 8 files changed, 291 insertions(+), 205 deletions(-)
---
base-commit: e1055cbfd6eb578417f3ce983cf44462e8465267
change-id: 20261126-getsockopt-memcg-isotp-052433c7adda

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


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

end of thread, other threads:[~2026-11-30 20:25 UTC | newest]

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

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