[PATCH 0/5] can: peak_usb: fixes, cleanup and input validation hardening

From: Stéphane Grosjean

Date: Thu Oct 08 2026 - 05:24:44 EST


This series contains a mix of bug fixes, cleanups, and hardening
improvements for the PEAK-System USB CAN drivers.

The first patch fixes a bug in CAN error frame generation where
CAN_ERR_CNT accidentally overwrites previously recorded CAN error
flags. As a result, information about previously detected error
conditions may be lost when error counters are reported.

The second and third patches are cleanup changes. One makes a public
header self-contained by including all required dependencies, while
the other reorders CAN_CTRLMODE_* flags in ctrlmode_supported for
improved readability without changing driver behavior.

The remaining patches strengthen validation of data received from USB
devices. They verify device-provided CAN channel numbers before they
are used as array indexes and introduce additional bounds checking
when parsing received message buffers.

Malformed messages are now rejected consistently, preventing possible
out-of-bounds memory accesses caused by corrupted or otherwise
untrusted device input.

Signed-off-by: Stéphane Grosjean <s.grosjean@xxxxxxxxxxxxxx>
---
Marc Kleine-Budde (1):
can: peak_usb: add missing includes

Stefan Günther (1):
can: peak_usb: fix missing CAN_ERR_FLAG when reporting error counters

Stéphane Grosjean (3):
can: peak_usb: sort ctrlmode_supported flags
can: peak_usb: validate channel numbers in PCAN-USB FD
can: peak_usb: harden PCAN-USB message validation

drivers/net/can/usb/peak_usb/pcan_usb.c | 29 ++++++++-----
drivers/net/can/usb/peak_usb/pcan_usb_core.h | 6 +++
drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 64 ++++++++++++++++++++--------
drivers/net/can/usb/peak_usb/pcan_usb_pro.c | 3 +-
4 files changed, 73 insertions(+), 29 deletions(-)
---
base-commit: a7bfaba4823e3c165bb2004c74eff7c096672bc7
change-id: 20261007-canfd_check_channel_idx-a4d7a1a1ee7d

Best regards,
--
Stéphane Grosjean <s.grosjean@xxxxxxxxxxxxxx>