firmware: cs_dsp: Fix memory leak on cs_dsp_power_up() error path
Subsystems (2)
Richard Fitzgerald
maintainerPATCH 1/1 firmware: cs_dsp: Fix memory leak on cs_dsp_power_up() error path
If cs_dsp_power_up() fails on or after cs_dsp_load() mark the controls disabled and free the alg regions.
--- drivers/firmware/cirrus/cs_dsp.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/firmware/cirrus/cs_dsp.c +6 -0
@@ -2793,6 +2793,7 @@ int cs_dsp_power_up(struct cs_dsp *dsp, const struct firmware *coeff_firmware, const char *coeff_filename, const char *fw_name) { + struct cs_dsp_coeff_ctl *ctl;int ret;mutex_lock (&dsp->pwr_lock);
@@ -2838,6 +2839,11 @@ int cs_dsp_power_up(struct cs_dsp *dsp,return 0 ; err_ena: +list_for_each_entry (ctl, &dsp->ctl_list, list) + ctl->enabled =0 ; + +cs_dsp_free_alg_regions (dsp); +if (dsp->ops->disable_core) dsp->ops->disable_core (dsp); err_mem:
Signature · 1 line
2.47.3
drivers/firmware/cirrus/cs_dsp.c int cs_dsp_power_up(struct cs_dsp *dsp, · line 2846
Quoted 12 lines
If
cs_dsp_power_up()fails on or aftercs_dsp_load()mark the controls disabled and free the alg regions.drivers/firmware/cirrus/cs_dsp.c +5
-0@@ -2838,6 +2839,11 @@ int cs_dsp_power_up(struct cs_dsp *dsp,return 0 ; err_ena: +list_for_each_entry (ctl, &dsp->ctl_list, list) + ctl->enabled =0 ; + +cs_dsp_free_alg_regions (dsp); +
Do we need something similar in cs_dsp_adsp1_power_up() as well?
Signature · 1 line
Mark Brown <[email protected]>
Quoted 1 line · Richard Fitzgerald
firmware:
cs_dsp: Fix memory leak oncs_dsp_power_up()error path
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4
Thanks!
[1/1] firmware: cs_dsp: Fix memory leak on cs_dsp_power_up() error path
https://git.kernel.org/broonie/sound/c/39d31f76ad1b
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark