Skip to contentSkip to conversation

ASoC: Fix incorrect kfree in error path

PATCH Applied Axel Lin 3 participants 8 messages Nov 16, 2010

Subsystems (5)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

cover ASoC: Fix incorrect kfree in error path

This serial of patches fixes incorrect kfree in error path.

Axel Lin (5):
ASoC: Fix incorrect kfree in ad1836_probe error path
ASoC: Fix incorrect kfree in ad193x_probe error path
ASoC: Fix incorrect kfree in aic3x_probe error path
ASoC: Fix incorrect kfree in wm8731_probe error path
ASoC: Fix incorrect kfree in wm8962_probe error path

 sound/soc/codecs/ad1836.c      |    1 -
 sound/soc/codecs/ad193x.c      |    1 -
 sound/soc/codecs/tlv320aic3x.c |    1 -
 sound/soc/codecs/wm8731.c      |    1 -
 sound/soc/codecs/wm8962.c      |    1 -
 5 files changed, 0 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.2
author
#1 lore raw

PATCH 1/5 ASoC: Fix incorrect kfree in ad1836_probe error path

We allocated memory for ad1836 in ad1836_spi_probe,
and will free the memory in either ad1836_spi_probe error path or ad1836_spi_remove.

Thus we should not call kfree(ad1836) in ad1836_probe, otherwise we have double free of ad1836.

---
 sound/soc/codecs/ad1836.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
sound/soc/codecs/ad1836.c +0 -1
index c71b05d..e5d3db9 100644
@@ -228,7 +228,6 @@ static int ad1836_probe(struct snd_soc_codec *codec)
 	if (ret < 0) {
 		dev_err(codec->dev, "failed to set cache I/O: %d\n",
 				ret);
-		kfree(ad1836);
 		return ret;
 	}
 
Signature · 1 line
1.7.2
author
#2 lore raw

PATCH 2/5 ASoC: Fix incorrect kfree in ad193x_probe error path

We allocated memory for ad193x in ad193x_spi_probe,
and will free the memory in either ad193x_spi_probe error path or ad193x_spi_remove.

Thus we should not call kfree(ad193x) in ad193x_probe, otherwise we have double free of ad193x.

---
 sound/soc/codecs/ad193x.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
sound/soc/codecs/ad193x.c +0 -1
index dc105d8..fd3e659 100644
@@ -364,7 +364,6 @@ static int ad193x_probe(struct snd_soc_codec *codec)
 	if (ret < 0) {
 		dev_err(codec->dev, "failed to set cache I/O: %d\n",
 				ret);
-		kfree(ad193x);
 		return ret;
 	}
 
Signature · 1 line
1.7.2
author
#3 lore raw

PATCH 3/5 ASoC: Fix incorrect kfree in aic3x_probe error path

We allocated memory for aic3x in aic3x_i2c_probe,
and will free the memory in either aic3x_i2c_probe error path or aic3x_i2c_remove.

Thus we should not call kfree(aic3x) in aic3x_probe, otherwise we have double free of aic3x.

---
 sound/soc/codecs/tlv320aic3x.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
sound/soc/codecs/tlv320aic3x.c +0 -1
index 6173c2b..df726a5 100644
@@ -1419,7 +1419,6 @@ err_get:
 	if (aic3x->gpio_reset >= 0)
 		gpio_free(aic3x->gpio_reset);
 err_gpio:
-	kfree(aic3x);
 	return ret;
 }
 
Signature · 1 line
1.7.2
author
#4 lore raw

PATCH 4/5 ASoC: Fix incorrect kfree in wm8731_probe error path

We allocated memory for wm8731 in wm8731_spi_probe / wm8731_i2c_probe, and will free the memory in either wm8731_spi_probe / wm8731_i2c_probe error path or wm8731_spi_remove / wm8731_i2c_remove.

Thus we should not call kfree(wm8731) in wm8731_probe, otherwise we have double free of wm8731.

---
 sound/soc/codecs/wm8731.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
sound/soc/codecs/wm8731.c +0 -1
index 95ade32..4b70958 100644
@@ -543,7 +543,6 @@ err_regulator_enable:
 err_regulator_get:
 	regulator_bulk_free(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
 
-	kfree(wm8731);
 	return ret;
 }
 
Signature · 1 line
1.7.2
author
#5 lore raw

PATCH 5/5 ASoC: Fix incorrect kfree in wm8962_probe error path

We allocated memory for wm8962 in wm8962_i2c_probe, and will free the memory in either wm8962_i2c_probe error path or wm8962_i2c_remove.

Thus we should not call kfree(wm8962) in wm8962_probe, otherwise we have double free of wm8962.

---
 sound/soc/codecs/wm8962.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
sound/soc/codecs/wm8962.c +0 -1
index e021866..9f6beca 100644
@@ -3874,7 +3874,6 @@ err_enable:
 err_get:
 	regulator_bulk_free(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
 err:
-	kfree(wm8962);
 	return ret;
 }
 
Signature · 1 line
1.7.2
Acked-by on the v1 series
#6 lore raw
In reply to Axel Lin
Quoted 9 lines · Axel Lin

This serial of patches fixes incorrect kfree in error path.

Axel Lin (5):
ASoC: Fix incorrect kfree in ad1836_probe error path
ASoC: Fix incorrect kfree in ad193x_probe error path
ASoC: Fix incorrect kfree in aic3x_probe error path
ASoC: Fix incorrect kfree in wm8731_probe error path
ASoC: Fix incorrect kfree in wm8962_probe error path

Quoted 7 lines
 sound/soc/codecs/ad1836.c      |    1 -
 sound/soc/codecs/ad193x.c      |    1 -
 sound/soc/codecs/tlv320aic3x.c |    1 -
 sound/soc/codecs/wm8731.c      |    1 -
 sound/soc/codecs/wm8962.c      |    1 -
 5 files changed, 0 insertions(+), 5 deletions(-)

All

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
Applied
#7 lore raw
Quoted 4 lines · Liam Girdwood
Quoted 1 line · Axel Lin

This serial of patches fixes incorrect kfree in error path.

All

Applied, thanks.