Skip to contentSkip to conversation

ASoC: soc-cache: Fix memory overflow in LZO initialization

PATCH Applied Dimitris Papastamos 3 participants 3 messages Nov 29, 2010 – Nov 30, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: soc-cache: Fix memory overflow in LZO initialization

The bitmap_zero() nbits argument was improperly set to reg_size but the underlying buffer was bmp_size long. This caused the memset to zero past the end of the allocated buffer and into the kernel heap causing strange kernel crashes sometimes by overwriting critical kernel structures.

---
 sound/soc/soc-cache.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/soc-cache.c +1 -1
index 9b1ba33..5143984 100644
@@ -1348,7 +1348,7 @@ static int snd_soc_lzo_cache_init(struct snd_soc_codec *codec)
 		ret = -ENOMEM;
 		goto err;
 	}
-	bitmap_zero(sync_bmp, reg_size);
+	bitmap_zero(sync_bmp, bmp_size);
 
 	/* allocate the lzo blocks and initialize them */
 	for (i = 0; i < blkcount; ++i) {
Signature · 1 line
1.7.3.2
Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · Dimitris Papastamos

The bitmap_zero() nbits argument was improperly set to reg_size but the underlying buffer was bmp_size long. This caused the memset to zero past the end of the allocated buffer and into the kernel heap causing strange kernel crashes sometimes by overwriting critical kernel structures.

---
 sound/soc/soc-cache.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/soc-cache.c +0 -0
index 9b1ba33..5143984 100644

sound/soc/soc-cache.c static int snd_soc_lzo_cache_init(struct snd_soc_codec *codec) · line 1354

Quoted 8 lines
sound/soc/soc-cache.c +1 -1
@@ -1348,7 +1348,7 @@ static int snd_soc_lzo_cache_init(struct snd_soc_codec *codec)
 		ret = -ENOMEM;
 		goto err;
 	}
-	bitmap_zero(sync_bmp, reg_size);
+	bitmap_zero(sync_bmp, bmp_size);
 
 	/* allocate the lzo blocks and initialize them */
 	for (i = 0; i < blkcount; ++i) {
Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
Applied
#2 lore raw
In reply to Dimitris Papastamos
Quoted 5 lines · Dimitris Papastamos

The bitmap_zero() nbits argument was improperly set to reg_size but the underlying buffer was bmp_size long. This caused the memset to zero past the end of the allocated buffer and into the kernel heap causing strange kernel crashes sometimes by overwriting critical kernel structures.

Applied, thanks.