summaryrefslogtreecommitdiffstats
path: root/sound/core/control.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-04 11:15:59 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-04 11:15:59 -0700
commitd9f73afcd364eb02b355921f6101db9e7ee4001c (patch)
tree43870615470ed12414fa9b3fcc1f249fc1fd36c4 /sound/core/control.c
parent53d22d886a13b9f6309c3333be55bd71d621eb8d (diff)
parente913b146493993c8ac33561655c590e58b500c6f (diff)
downloadop-kernel-dev-d9f73afcd364eb02b355921f6101db9e7ee4001c.zip
op-kernel-dev-d9f73afcd364eb02b355921f6101db9e7ee4001c.tar.gz
Merge branch 'fix/misc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'fix/misc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: ALSA: i2c/other/ak4xx-adda: Fix a compile warning with CONFIG_PROCFS=n ALSA: prevent heap corruption in snd_ctl_new()
Diffstat (limited to 'sound/core/control.c')
-rw-r--r--sound/core/control.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index 070aab4..45a8180 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -31,6 +31,7 @@
/* max number of user-defined controls */
#define MAX_USER_CONTROLS 32
+#define MAX_CONTROL_COUNT 1028
struct snd_kctl_ioctl {
struct list_head list; /* list of all ioctls */
@@ -195,6 +196,10 @@ static struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control,
if (snd_BUG_ON(!control || !control->count))
return NULL;
+
+ if (control->count > MAX_CONTROL_COUNT)
+ return NULL;
+
kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL);
if (kctl == NULL) {
snd_printk(KERN_ERR "Cannot allocate control instance\n");
OpenPOWER on IntegriCloud