Re: [BUG] systemd-devd triggers kernel memleak apparently in drivers/core/dd.c: driver_register()

From: Greg Kroah-Hartman
Date: Tue Mar 28 2023 - 07:29:31 EST


On Tue, Mar 28, 2023 at 01:13:33PM +0200, Mirsad Todorovac wrote:
> Hi all,
>
> Here is another kernel memory leak report, just as I thought we have done with
> them by the xhci patch by Mathias.
>
> The memory leaks were caught on an AlmaLinux 8.7 (CentOS) fork system, running
> on a Lenovo desktop box (see lshw.txt) and the newest Linux kernel 6.3-rc4 commit
> g3a93e40326c8 with Mathias' patch for a xhci systemd-devd triggered leak.
>
> See: <20230327095019.1017159-1-mathias.nyman@xxxxxxxxxxxxxxx> on LKML.
>
> This leak is also systemd-devd triggered, except for the memstick_check() leaks
> which I was unable to bisect due to the box not booting older kernels (work in
> progress).
>
> unreferenced object 0xffff88ad12392710 (size 96):
> comm "systemd-udevd", pid 735, jiffies 4294896759 (age 2257.568s)
> hex dump (first 32 bytes):
> 53 65 72 69 61 6c 50 6f 72 74 31 41 64 64 72 65 SerialPort1Addre
> 73 73 2c 33 46 38 2f 49 52 51 34 3b 5b 4f 70 74 ss,3F8/IRQ4;[Opt
> backtrace:
> [<ffffffffae8fb26c>] slab_post_alloc_hook+0x8c/0x3e0
> [<ffffffffae902b49>] __kmem_cache_alloc_node+0x1d9/0x2a0
> [<ffffffffae8773c9>] __kmalloc_node_track_caller+0x59/0x180
> [<ffffffffae866a1a>] kstrdup+0x3a/0x70
> [<ffffffffc0d839aa>] tlmi_extract_output_string.isra.0+0x2a/0x60 [think_lmi]
> [<ffffffffc0d83b64>] tlmi_setting.constprop.4+0x54/0x90 [think_lmi]
> [<ffffffffc0d842b1>] tlmi_probe+0x591/0xba0 [think_lmi]
> [<ffffffffc051dc53>] wmi_dev_probe+0x163/0x230 [wmi]

Why aren't you looking at the wmi.c driver? That should be where the
issue is, not the driver core, right?

thanks,

greg k-h