Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0adde63 authored by Laxminath Kasam's avatar Laxminath Kasam
Browse files

ASoC: msm8x16-wcd: Fix slab corruption due to incorrect malloc size



In SSR, when reg_cache param is updated using kmemdup
size parameter used is reg_word_size which is value 1.
This will result in slab corruption. Update the size
parameter to correct size.

Change-Id: Ia4b30281f201bd4cef31d7068f021e7c964e0d30
Signed-off-by: default avatarLaxminath Kasam <lkasam@codeaurora.org>
parent aa3aa09a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -5154,7 +5154,9 @@ static int msm8x16_wcd_device_up(struct snd_soc_codec *codec)
		pr_debug("%s: Update ASOC cache", __func__);
		kfree(codec->reg_cache);
		codec->reg_cache = kmemdup(codec_drv->reg_cache_default,
					codec_drv->reg_word_size, GFP_KERNEL);
					   (codec_drv->reg_cache_size
					    * codec_drv->reg_word_size),
					   GFP_KERNEL);
		if (!codec->reg_cache) {
			pr_err("%s: Cache update failed!\n", __func__);
			mutex_unlock(&codec->mutex);