mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jimmy Assarsson <extja@kvaser.com>
To: Seungjin Bae <eeodqql09@gmail.com>
Cc: Kyungtae Kim <Kyungtae.Kim@dartmouth.edu>,
	linux-can@vger.kernel.org, linux-kernel@vger.kernel.org,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	Vincent Mailhol <mailhol@kernel.org>
Subject: Re: [PATCH v2] can: kvaser_usb: leaf: Fix potential infinite loop in command parsers
Date: Mon, 3 Nov 2025 09:51:16 +0100	[thread overview]
Message-ID: <c65fae56-cb75-4039-908d-25c41338b801@kvaser.com> (raw)
In-Reply-To: <CAAsoPpWaj4iq7HN7DiGpEGTpCv34jNneC-5oLdtyou9qniU2Yw@mail.gmail.com>

On 10/29/25 20:06, Seungjin Bae wrote:
> Hello Jimmy,
> 
> Thank you for trying to reproduce the issue and for the detailed
> explanation of the firmware logic.
> 
> You are correct that this issue would not occur with the standard Kvaser
> firmware. The vulnerability I reported wasn’t found by running code
> on an actual Kvaser device.
> 
> Instead, I discovered this issue by performing analysis on the driver
> code using a symbolic execution tool. This tool demonstrated that
> the driver contains a vulnerable code path.
> 
> My goal was to show that if a malicious device is connected—one that
> sends a specifically crafted packet sequence not normally produced by
> the firmware—the driver code will process it incorrectly and cause
> the kernel panic.
> 
> So regretfully, I don’t have any hardware information yet.

Sorry, I overlooked the title, and assumed this was a problem you had
encountered with a real device.

Patch LGTM and tested OK with actual Kvaser devices:
Reviewed-by: Jimmy Assarsson <extja@kvaser.com>
Tested-by: Jimmy Assarsson <extja@kvaser.com>

Thanks!
/jimmy


> Thank you for your precious time.
> 
> Best,
> Seungjin Bae
> 
> 2025년 10월 29일 (수) 오전 6:53, Jimmy Assarsson <extja@kvaser.com 
> <mailto:extja@kvaser.com>>님이 작성:
> 
>     On 10/26/25 14:26, Jimmy Assarsson wrote:
>      > Hi Seungjin,
>      >
>      > Thanks for fixing this!
>      > I'll do some testing in the beginning of next week.
>      > Which Kvaser device did you use when you discovered the problem?
>      >
>      > Best regards,
>      > jimmy
> 
>     Hi Seungjin,
> 
>     I've not been able to reproduce this problem, when testing with the
>     latest firmware on multiple different devices.
> 
>     If the next command in the firmware packet queue, doesn't fit within the
>     current endpoint transaction (wMaxPacketSize), the firmware will
>     terminate the transaction with a zero byte. The driver then interprets
>     this as a zero-length command, and skip to the next transaction.
> 
>     The firmware is responsible to insert a "zero termination byte" only
>     when there is already one or more packets in the current transaction.
>     Since all commands have even lengths (4,8,10,12,16,20,24,30,32 bytes)
>     and the wMaxPacketSize is also even (64 bytes or 512 bytes, depending on
>     the device), I cannot see a situation where the zero termination byte
>     would be inserted exactly at the wMaxPacketSize boundary.
> 
>     Can you please provide which Kvaser device and firmware you use:
>         lsusb -d 0bfd:
>         ethtool -i can0
> 
>     Best regards,
>     jimmy

  parent reply	other threads:[~2025-11-03  8:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAAsoPpV7Kzap1Sn8QFtBbvwW-DJMTTcU_bBOUDYYC286Uaddtg@mail.gmail.com>
2025-10-23 16:27 ` pip-izony
2025-10-26 13:26   ` Jimmy Assarsson
2025-10-29 10:53     ` Jimmy Assarsson
     [not found]       ` <CAAsoPpWaj4iq7HN7DiGpEGTpCv34jNneC-5oLdtyou9qniU2Yw@mail.gmail.com>
2025-11-03  8:51         ` Jimmy Assarsson [this message]
2025-10-23  6:16 [PATCH] can: kvaser_usb: leaf: Fix infinite loop on zero-length cmd Marc Kleine-Budde
2025-10-23 16:30 ` [PATCH v2] can: kvaser_usb: leaf: Fix potential infinite loop in command parsers pip-izony

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c65fae56-cb75-4039-908d-25c41338b801@kvaser.com \
    --to=extja@kvaser.com \
    --cc=Kyungtae.Kim@dartmouth.edu \
    --cc=eeodqql09@gmail.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mailhol@kernel.org \
    --cc=mkl@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®