Re: [PATCH] USB: core: Use `krealloc()` in `usb_cache_string()`

From: Bence Csókás

Date: Sun Mar 15 2026 - 06:35:11 EST




On 3/15/26 10:59, Bence Csókás wrote:
Hi,

On 3/15/26 10:47, Greg Kroah-Hartman wrote:
On Sun, Mar 15, 2026 at 10:40:48AM +0100, Bence Csókás wrote:
Also, how was this tested?

I just compiled and booted it on my Arch box (with the original vendor
config), an AthlonII X2 PC. I'm now typing this mail on a USB keyboard and
mouse under Plasma, running this kernel :) I also plugged in a pendrive,
mounted it, `ls`'d the mount, unmounted, unplugged, and did this 2 more
times.

I realize I should probably put this info under the dashes. I'll prepare a
v2.

Try looking at the USB strings in the device, as that's the path here
that is exercised.  Just using the device doesn't actually grab them
from the descriptor table.

Sure.

  $ sudo lsusb -vvv | grep iProduct
  can't get debug descriptor: Resource temporarily unavailable
    iProduct                2 OHCI PCI host controller
    iProduct                2 HP USB Smart Card Keyboard
  can't get device qualifier: Resource temporarily unavailable
  can't get debug descriptor: Resource temporarily unavailable
    iProduct                2 USB OPTICAL MOUSE
  can't get debug descriptor: Resource temporarily unavailable
  can't get device qualifier: Resource temporarily unavailable
  can't get debug descriptor: Resource temporarily unavailable
    iProduct                2 EHCI Host Controller
    iProduct                2 EHCI Host Controller
  can't get device qualifier: Resource temporarily unavailable
  can't get debug descriptor: Resource temporarily unavailable
  can't get debug descriptor: Resource temporarily unavailable
    iProduct                2 Disk 2.0
    iProduct                2 EHCI Host Controller
  can't get device qualifier: Resource temporarily unavailable
  can't get debug descriptor: Resource temporarily unavailable
  can't get debug descriptor: Resource temporarily unavailable
    iProduct                2 OHCI PCI host controller
    iProduct                2 OHCI PCI host controller
  can't get debug descriptor: Resource temporarily unavailable
  can't get debug descriptor: Resource temporarily unavailable
    iProduct                2 OHCI PCI host controller

Are these -EAGAINs cause for concern?

It happens with the vendor kernel (6.19.8-arch1-1) too, so it's probably just some weirdness in my HW...

And sorry for the extra review, I'm a bit picky about this function, it
was my first contribution to Linux way back in 1999 or so, and happen to
know too much about USB descriptor strings :)

A good review is a thorough review.

thanks,

greg k-h


Bence