ASoC: soc-cache: Fix memory overflow in LZO initialization
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>
Mon, 29 Nov 2010 11:43:33 +0000 (11:43 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 30 Nov 2010 12:51:51 +0000 (12:51 +0000)
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.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/soc-cache.c

index 9b1ba33e6fe9d52d0cd449053660ef343877f41d..514398463f7d27ea08fdf367b5d98b32bef359ab 100644 (file)
@@ -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) {