public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] can: usb: f81604: handle short interrupt urb messages properly
@ 2026-02-23 12:10 Greg Kroah-Hartman
  2026-02-23 12:10 ` [PATCH 2/3] can: usb: f81604: handle bulk write errors properly Greg Kroah-Hartman
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2026-02-23 12:10 UTC (permalink / raw)
  To: linux-can
  Cc: linux-kernel, Greg Kroah-Hartman, Ji-Ze Hong (Peter Hong),
	Marc Kleine-Budde, Vincent Mailhol, stable

If an interrupt urb is recieved that is not the correct length, properly
detect it and don't attempt to treat the data as valid.

Cc: "Ji-Ze Hong (Peter Hong)" <peter_hong@fintek.com.tw>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Vincent Mailhol <mailhol@kernel.org>
Cc: stable <stable@kernel.org>
Assisted-by: gkh_clanker_2000
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/can/usb/f81604.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/can/usb/f81604.c b/drivers/net/can/usb/f81604.c
index 76578063ac82..c61bd30d1765 100644
--- a/drivers/net/can/usb/f81604.c
+++ b/drivers/net/can/usb/f81604.c
@@ -620,6 +620,12 @@ static void f81604_read_int_callback(struct urb *urb)
 		netdev_info(netdev, "%s: Int URB aborted: %pe\n", __func__,
 			    ERR_PTR(urb->status));
 
+	if (urb->actual_length < sizeof(*data)) {
+		netdev_warn(netdev, "%s: short int URB: %u < %zu\n",
+			    __func__, urb->actual_length, sizeof(*data));
+		goto resubmit_urb;
+	}
+
 	switch (urb->status) {
 	case 0: /* success */
 		break;
-- 
2.53.0


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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 12:10 [PATCH 1/3] can: usb: f81604: handle short interrupt urb messages properly Greg Kroah-Hartman
2026-02-23 12:10 ` [PATCH 2/3] can: usb: f81604: handle bulk write errors properly Greg Kroah-Hartman
2026-02-23 12:10 ` [PATCH 3/3] can: usb: f81604: correctly anchor the urb in the read bulk callback Greg Kroah-Hartman
2026-03-02 10:08 ` [PATCH 1/3] can: usb: f81604: handle short interrupt urb messages properly Marc Kleine-Budde
2026-03-02 12:50   ` Greg Kroah-Hartman

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