ASoC: soc-cache: Fix memory overflow in LZO initialization
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
@@ -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
Quoted 16 lines · Dimitris Papastamos
The
bitmap_zero()nbits argument was improperly set toreg_sizebut the underlying buffer wasbmp_sizelong. 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.Signed-off-by Dimitris Papastamos <[email protected]>--- sound/soc/soc-cache.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)sound/soc/soc-cache.c +0
-0
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
Mark Brown
AppliedQuoted 5 lines · Dimitris Papastamos
The
bitmap_zero()nbits argument was improperly set toreg_sizebut the underlying buffer wasbmp_sizelong. 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.