summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2016-01-18 16:12:40 +0300
committerLuis Henriques <luis.henriques@canonical.com>2016-02-02 22:10:00 +0300
commit27b7f1419c309670dc0b0fe42091dd8017e45ee5 (patch)
tree861d35db34778817247bb7e70de2be0a9c57deff
parentb88eef285f4c8e59b97f248f409c756fc5df06aa (diff)
downloadlinux-27b7f1419c309670dc0b0fe42091dd8017e45ee5.tar.xz
ALSA: control: Avoid kernel warnings from tlv ioctl with numid 0
commit c0bcdbdff3ff73a54161fca3cb8b6cdbd0bb8762 upstream. When a TLV ioctl with numid zero is handled, the driver may spew a kernel warning with a stack trace at each call. The check was intended obviously only for a kernel driver, but not for a user interaction. Let's fix it. This was spotted by syzkaller fuzzer. Reported-by: Dmitry Vyukov <dvyukov@google.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
-rw-r--r--sound/core/control.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index 8cdf0a4b327b..1d395d865f1b 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -1324,6 +1324,8 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file,
return -EFAULT;
if (tlv.length < sizeof(unsigned int) * 2)
return -EINVAL;
+ if (!tlv.numid)
+ return -EINVAL;
down_read(&card->controls_rwsem);
kctl = snd_ctl_find_numid(card, tlv.numid);
if (kctl == NULL) {