lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2026011117-surrender-dude-9f5b@gregkh>
Date: Sun, 11 Jan 2026 08:33:53 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Seungjin Bae <eeodqql09@...il.com>
Cc: Ingo Molnar <mingo@...nel.org>, Thomas Gleixner <tglx@...utronix.de>,
	Kyungtae Kim <Kyungtae.Kim@...tmouth.edu>,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: r8a66597-hcd: fix potential divide-by-zero in
 prepare_packet_read()

On Sun, Jan 11, 2026 at 02:25:54AM -0500, Seungjin Bae wrote:
> 2026년 1월 10일 (토) PM 3:02, Greg Kroah-Hartman <gregkh@...uxfoundation.org>님이
> 작성:
> 
> > On Sat, Jan 10, 2026 at 02:22:33PM -0500, pip-izony wrote:
> > > From: Seungjin Bae <eeodqql09@...il.com>
> > >
> > > The `prepare_packet_read()` function calculates the number of packets
> > > required for a transfer by dividing the transfer buffer length by the
> > > maximum packet size (`td->maxpacket`). The `td->maxpacket` is
> > > initialized in `r8a66597_make_td()` function based on the endpoint
> > > descriptor. However, it does not validate whether `td->maxpacket` is
> > > zero before using it in the `DIV_ROUND_UP` macro.
> > >
> > > If a malicious USB device sends a descriptor with `wMaxPacketSize` set to
> > > 0, it triggers a divide-by-zero exception (kernel panic).
> >
> > Same here, when can this happen, before a device is bound to the device
> > or afterward?
> >
> > thanks,
> >
> > greg k-h
> >
> 
> This logic triggers after the driver is bound, specifically during the
> packet preparation phase.
> 
> I checked `usb_parse_endpoint()` and confirmed that if `wMaxPacketSize`
> is 0, it only prints a warning and continues the binding process.
> It does not reject the device at that stage.
> 
> However, I missed that `usb_submit_urb()` explicitly checks if
> `wMaxPacketSize` is 0 before calling the driver's enqueue function.
> Since the core rejects such requests with -EMSGSIZE, this code path
> is unreachable in practice.

That's great to verify, thanks for checking.

also, when writing a patch that says "this will fix a crash", please
verify that the tool that found this issue is actually correct and not
making things up.  We have a lot of bad AI generated bug reports these
days, so be careful as we are getting much more sensitive to this.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ