Skip to content
Snippets Groups Projects
Commit bfdcf7bd authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Oleksii Kutuzov
Browse files

UPSTREAM: ASoC: SOF: ipc3-topology: Prevent double freeing of ipc_control_data via load_bytes


We have sanity checks for byte controls and if any of the fail the locally
allocated scontrol->ipc_control_data is freed up, but not set to NULL.

On a rollback path of the error the higher level code will also try to free
the scontrol->ipc_control_data which will eventually going to lead to
memory corruption as double freeing memory is not a good thing.

Fixes: b5cee8fe ("ASoC: SOF: topology: Make control parsing IPC agnostic")
Reported-by: default avatarSeppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Change-Id: I83211359bb304fcf4d7b1dd85ab71dedd0002abe
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarSeppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220712130103.31514-1-peter.ujfalusi@linux.intel.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 705db440
No related branches found
No related tags found
1 merge request!13[UPSTREAM] Add Audio-related patches from Mediatek's Release 24.0
......@@ -1644,6 +1644,7 @@ static int sof_ipc3_control_load_bytes(struct snd_sof_dev *sdev, struct snd_sof_
return 0;
err:
kfree(scontrol->ipc_control_data);
scontrol->ipc_control_data = NULL;
return ret;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment