From: Takashi Iwai <tiwai@suse.de>
To: "Dmitry Vyukov" <dvyukov@google.com>
Cc: <alsa-devel@alsa-project.org>, "Jaroslav Kysela" <perex@perex.cz>,
"Takashi Sakamoto" <o-takashi@sakamocchi.jp>,
"LKML" <linux-kernel@vger.kernel.org>,
"Alexander Potapenko" <glider@google.com>,
"Kostya Serebryany" <kcc@google.com>,
"syzkaller" <syzkaller@googlegroups.com>,
"Sasha Levin" <sasha.levin@oracle.com>
Subject: Re: sound: BUG in snd_ctl_find_numid
Date: Mon, 18 Jan 2016 14:17:27 +0100 [thread overview]
Message-ID: <s5h37tvuivs.wl-tiwai@suse.de> (raw)
In-Reply-To: <CACT4Y+bWU+e8zVaMfCee9+6F4J_3Z_9bhNJwz5Rp559CBtMPsw@mail.gmail.com>
On Mon, 18 Jan 2016 13:59:49 +0100,
Dmitry Vyukov wrote:
>
> Hello,
>
> The following program triggers a BUG in snd_ctl_find_numid:
Do I understand correctly that you meant a kernel WARNING with a stack
trace as a "BUG"? If so, the patch below should cover it.
thanks,
Takashi
-- 8< --
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] ALSA: control: Avoid kernel warnings from tlv ioctl with
numid 0
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>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/core/control.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/core/control.c b/sound/core/control.c
index 196a6fe100ca..a85d45595d02 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -1405,6 +1405,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) {
--
2.7.0
next prev parent reply other threads:[~2016-01-18 13:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-18 12:59 Dmitry Vyukov
2016-01-18 13:17 ` Takashi Iwai [this message]
2016-01-18 13:18 ` Dmitry Vyukov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5h37tvuivs.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=kcc@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=o-takashi@sakamocchi.jp \
--cc=perex@perex.cz \
--cc=sasha.levin@oracle.com \
--cc=syzkaller@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®