]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ALSA: pcmtest: Fix resource leaks in module init error paths
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Tue, 21 Apr 2026 13:03:06 +0000 (10:03 -0300)
committerTakashi Iwai <tiwai@suse.de>
Tue, 21 Apr 2026 16:18:38 +0000 (18:18 +0200)
commitd5d5f80416a3a749906c04d56575e2290792654b
tree9534276f289c9a517fbe0ef64f20d3707d87590b
parent12c1c672d46dba62bad1293977780c98e29315b4
ALSA: pcmtest: Fix resource leaks in module init error paths

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@vger.kernel.org
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Link: https://patch.msgid.link/20260421-alsa-pcmtest-init-unwind-v1-1-03fe0c423dbb@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/drivers/pcmtest.c