[PATCH can 0/3] can: gs_usb: fix USB bulk in and out callbacks

Marc Kleine-Budde posted 3 patches 1 month ago
drivers/net/can/usb/gs_usb.c | 102 +++++++++++++++++++++++++++++++++++++------
1 file changed, 88 insertions(+), 14 deletions(-)
[PATCH can 0/3] can: gs_usb: fix USB bulk in and out callbacks
Posted by Marc Kleine-Budde 1 month ago
The bulk-out callback gs_usb_xmit_callback() does not take care of the
cleanup of failed transfers of URBs. The 1st patch adds the missing
cleanup.

The bulk-in callback gs_usb_receive_bulk_callback() accesses the buffer of
the URB without checking how much data has actually been received. The last
2 patches fix this problem.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
Changes in v2:
- patch 3: TX-echo length: take timestamps into account (thanks: Henrik)
- Link to v1: https://patch.msgid.link/20251108-gs_usb-fix-usb-callbacks-v1-0-8a2534a7ea05@pengutronix.de

---
Marc Kleine-Budde (3):
      can: gs_usb: gs_usb_xmit_callback(): fix handling of failed transmitted URBs
      can: gs_usb: gs_usb_receive_bulk_callback(): check actual_length before accessing header
      can: gs_usb: gs_usb_receive_bulk_callback(): check actual_length before accessing data

 drivers/net/can/usb/gs_usb.c | 102 +++++++++++++++++++++++++++++++++++++------
 1 file changed, 88 insertions(+), 14 deletions(-)
---
base-commit: 407a06507c2358554958e8164dc97176feddcafc
change-id: 20251107-gs_usb-fix-usb-callbacks-5fa2955299c3

Best regards,
--  
Marc Kleine-Budde <mkl@pengutronix.de>
Re: [PATCH can 0/3] can: gs_usb: fix USB bulk in and out callbacks
Posted by Marc Kleine-Budde 1 month ago
On 14.11.2025 09:36:42, Marc Kleine-Budde wrote:
> The bulk-out callback gs_usb_xmit_callback() does not take care of the
> cleanup of failed transfers of URBs. The 1st patch adds the missing
> cleanup.
>
> The bulk-in callback gs_usb_receive_bulk_callback() accesses the buffer of
> the URB without checking how much data has actually been received. The last
> 2 patches fix this problem.
>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

Applied to linux-can.

regards,
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   |