]> git.itanic.dy.fi Git - linux-stable/commitdiff
ASoC: dapm: delete dapm_kcontrol_data paths list before freeing it
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Mon, 4 Jun 2018 11:13:26 +0000 (12:13 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Jul 2018 09:21:27 +0000 (11:21 +0200)
commit ff2faf1289c1f81b5b26b9451dd1c2006aac8db8 upstream.

dapm_kcontrol_data is freed as part of dapm_kcontrol_free(), leaving the
paths pointer dangling in the list.

This leads to system crash when we try to unload and reload sound card.
I hit this bug during ADSP crash/reboot test case on Dragon board DB410c.

Without this patch, on SLAB Poisoning enabled build, kernel crashes with
"BUG kmalloc-128 (Tainted: G        W        ): Poison overwritten"

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/soc/soc-dapm.c

index 6a438a3615922089520a30a980c2559cb73ffe07..9e784cc3e5d2970ff997eb769dcde3372ab0011e 100644 (file)
@@ -425,6 +425,8 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
 static void dapm_kcontrol_free(struct snd_kcontrol *kctl)
 {
        struct dapm_kcontrol_data *data = snd_kcontrol_chip(kctl);
+
+       list_del(&data->paths);
        kfree(data->wlist);
        kfree(data);
 }