Re: [PATCH] ALSA: pcmtest: Fix resource leaks in module init error paths

From: Takashi Iwai

Date: Tue Apr 21 2026 - 12:25:21 EST


On Tue, 21 Apr 2026 15:03:06 +0200,
Cássio Gabriel wrote:
>
> pcmtest allocates its pattern buffers and creates its debugfs tree
> before registering the platform device and driver, but mod_init()
> does not release those resources when a later init step fails.
>
> As a result, a debugfs directory creation failure leaks the pattern
> buffers, while platform_device_register() and
> platform_driver_register() failures leave both the pattern buffers
> and the debugfs tree behind. The recent fix for failed device
> registration only dropped the embedded device reference.
>
> Add the missing cleanup for the debugfs tree and pattern buffers in
> the remaining module init error paths.
>
> Fixes: 315a3d57c64c ("ALSA: Implement the new Virtual PCM Test Driver")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Cássio Gabriel <cassiogabrielcontato@xxxxxxxxx>

Thanks, applied now.


Takashi