Skip to content

Commit 66615e6

Browse files
gregkhSasha Levin
authored andcommitted
can: usb: f81604: handle short interrupt urb messages properly
commit 7299b1b upstream. If an interrupt urb is received 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@kernel.org Assisted-by: gkh_clanker_2000 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://patch.msgid.link/2026022331-opal-evaluator-a928@gregkh Fixes: 88da174 ("can: usb: f81604: add Fintek F81604 support") Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b8f9ca8 commit 66615e6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/net/can/usb/f81604.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,12 @@ static void f81604_read_int_callback(struct urb *urb)
626626
netdev_info(netdev, "%s: Int URB aborted: %pe\n", __func__,
627627
ERR_PTR(urb->status));
628628

629+
if (urb->actual_length < sizeof(*data)) {
630+
netdev_warn(netdev, "%s: short int URB: %u < %zu\n",
631+
__func__, urb->actual_length, sizeof(*data));
632+
goto resubmit_urb;
633+
}
634+
629635
switch (urb->status) {
630636
case 0: /* success */
631637
break;

0 commit comments

Comments
 (0)