mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
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: 315a3d57c6 ("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>
This commit is contained in:
parent
12c1c672d4
commit
d5d5f80416
|
|
@ -754,15 +754,24 @@ static int __init mod_init(void)
|
|||
|
||||
err = init_debug_files(buf_allocated);
|
||||
if (err)
|
||||
return err;
|
||||
goto err_free_patterns;
|
||||
err = platform_device_register(&pcmtst_pdev);
|
||||
if (err) {
|
||||
platform_device_put(&pcmtst_pdev);
|
||||
return err;
|
||||
goto err_clear_debug;
|
||||
}
|
||||
err = platform_driver_register(&pcmtst_pdrv);
|
||||
if (err)
|
||||
if (err) {
|
||||
platform_device_unregister(&pcmtst_pdev);
|
||||
goto err_clear_debug;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_clear_debug:
|
||||
clear_debug_files();
|
||||
err_free_patterns:
|
||||
free_pattern_buffers();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user