Re: BUG: drivers/usb/host/xhci: memleak in alloc from xhci_disable_usb3_lpm_timeout()

From: Mirsad Goran Todorovac
Date: Mon Mar 27 2023 - 08:04:19 EST


On 27.3.2023. 11:41, Mathias Nyman wrote:
On 25.3.2023 13.33, Mirsad Goran Todorovac wrote:
On 25. 03. 2023. 12:27, Mirsad Goran Todorovac wrote:
Hi all!

Here are again the good news and the bad news:

BAD:  another kernel memory leak detected (one more to hunt down and fix)
GOOD: another kernel memory leak detected (one less unaccounted for)

I tried to make some fun, but maintainers are busy folks, so let's get down
to business:

---
Nine (9) new systemd-udevd kernel memory leaks occurred (unable to reproduce).

The platform is Ubuntu 22.10 with (relatively recent) systemd 251.4-1ubuntu7.1
on LENOVO_MT_82H8_BU_idea_FM_IdeaPad 3 15ITL6 with BIOS GGCN51WW from 11/16/2022.

The symptom (/sys/kernel/debug/kmemleak output):

unreferenced object 0xffff909698ff9280 (size 64):
   comm "systemd-udevd", pid 436, jiffies 4294893239 (age 6287.088s)
   hex dump (first 32 bytes):
     e0 51 bb 99 96 90 ff ff 00 00 00 00 00 00 00 00  .Q..............
     40 5b bb 99 96 90 ff ff 00 00 00 00 00 00 00 00  @[..............
   backtrace:
     [<ffffffffb29de94c>] slab_post_alloc_hook+0x8c/0x320
     [<ffffffffb29e5107>] __kmem_cache_alloc_node+0x1c7/0x2b0
     [<ffffffffb2962f3b>] kmalloc_node_trace+0x2b/0xa0
     [<ffffffffb31af2ec>] xhci_alloc_command+0x7c/0x1b0
     [<ffffffffb31af451>] xhci_alloc_command_with_ctx+0x21/0x70
     [<ffffffffb31a8a3e>] xhci_change_max_exit_latency+0x2e/0x1c0>>      [<ffffffffb31a8c5b>] xhci_disable_usb3_lpm_timeout+0x7b/0xb0
     [<ffffffffb31457a7>] usb_disable_link_state+0x57/0xe0

Thanks for the report.

I think I found the leak, and wrote a patch for it.
Any chance you could test it with the same setup?

https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git/commit/?h=for-usb-linus&id=8bacee588602ed74cc22aaf4c56b796300e5a943

Hi, Mathias,

Great you have found the leak!

I cannot make testing in the same setup because I can access that particular box
until after I finish my day job.

I will prioritise it.

If this is the catch, it will save me almost a dozen bisect builds. :-)

Best regards,
Mirsad

--
Mirsad Todorovac
System engineer
Faculty of Graphic Arts | Academy of Fine Arts
University of Zagreb
Republic of Croatia, the European Union

Sistem inženjer
Grafički fakultet | Akademija likovnih umjetnosti
Sveučilište u Zagrebu