Re: [PATCH net] can: peak_usb: accept short uCAN end-of-list records
From: Stéphane Grosjean
Date: Wed Oct 21 2026 - 06:20:49 EST
Hi Marc,
On 19.10.2026 00:46:34, Liu Changjie wrote:
> A PCAN-USB FD v2 running firmware 3.2.0 sends a 16-byte status
> record followed by a four-byte zero-size end marker. These transfers
> cause repeated receive-buffer dumps while the interface is up.
>
> pcan_usb_fd_decode_buf() requires a complete 12-byte struct pucan_msg
> before checking the size field, so it rejects the end marker with
> -EBADMSG.
Right: the firmware may terminate a list of records with a short null
record, and it doesn't need to be a full struct pucan_msg. Only its size
field matters.
The patch keeps all the record length checks added by 93fcab2c6968 and
only accepts the end marker earlier, so:
Reviewed-by: Stéphane Grosjean <s.grosjean@xxxxxxxxxxxxxx>
Marc, since 93fcab2c6968 has been backported to the 6.6, 6.12 and 7.1
stable trees, could you add "Cc: stable@xxxxxxxxxxxxxxx" when applying?
Thanks,
Stéphane
----- Mail original -----
> Stéphane,
>
> can you have a look at this?
>
> On 19.10.2026 00:46:34, Liu Changjie wrote:
> > A PCAN-USB FD v2 running firmware 3.2.0 sends a 16-byte status
> > record followed by a four-byte zero-size end marker. These
> > transfers
> > cause repeated receive-buffer dumps while the interface is up.
> >
> > pcan_usb_fd_decode_buf() requires a complete 12-byte struct
> > pucan_msg
> > before checking the size field, so it rejects the end marker with
> > -EBADMSG.
> >
> > Check that the size field is present before testing for an end
> > marker.
> > Require the full header for nonzero-size records and keep the
> > remaining
> > record and payload length checks.
> >
> > Fixes: 93fcab2c6968 ("can: peak_usb: validate uCAN receive record
> > lengths")
> > Assisted-by: LLM
> > Signed-off-by: Liu Changjie <liucj1228@xxxxxxxxxxx>
>
> Marc
>
> --
> Pengutronix e.K. | Marc Kleine-Budde |
> Embedded Linux | https://www.pengutronix.de |
> Vertretung Nürnberg | Phone: +49-5121-206917-129 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
>