From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jaroslav Kysela <perex@perex.cz>,
Ruslan Bilovol <ruslan.bilovol@gmail.com>
Cc: alsa-devel@alsa-project.org,
Michael Drake <michael.drake@codethink.co.uk>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org,
Takashi Iwai <tiwai@suse.com>,
Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Subject: [PATCH] ALSA: usb-audio: ensure that cluster header size is enough
Date: Sat, 22 Sep 2018 16:38:32 +0300 [thread overview]
Message-ID: <20180922133831.GA6792@mwanda> (raw)
I think we need a check to make sure that "hc_header.wLength" is large
enough for a struct struct uac3_cluster_header_descriptor.
Fixes: 9a2fe9b801f5 ("ALSA: usb: initial USB Audio Device Class 3.0 support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index 67cf849aa16b..f7179ce39a19 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -968,6 +968,12 @@ snd_usb_get_audioformat_uac3(struct snd_usb_audio *chip,
* and request Cluster Descriptor
*/
wLength = le16_to_cpu(hc_header.wLength);
+ if (wLength < sizeof(*cluster)) {
+ dev_err(&dev->dev,
+ "%u:%d : cluster header size too small %d\n",
+ iface_no, altno, wLength);
+ return ERR_PTR(-EIO);
+ }
cluster = kzalloc(wLength, GFP_KERNEL);
if (!cluster)
return ERR_PTR(-ENOMEM);
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jaroslav Kysela <perex@perex.cz>,
Ruslan Bilovol <ruslan.bilovol@gmail.com>
Cc: alsa-devel@alsa-project.org,
Michael Drake <michael.drake@codethink.co.uk>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org,
Takashi Iwai <tiwai@suse.com>,
Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Subject: [PATCH] ALSA: usb-audio: ensure that cluster header size is enough
Date: Sat, 22 Sep 2018 13:38:32 +0000 [thread overview]
Message-ID: <20180922133831.GA6792@mwanda> (raw)
I think we need a check to make sure that "hc_header.wLength" is large
enough for a struct struct uac3_cluster_header_descriptor.
Fixes: 9a2fe9b801f5 ("ALSA: usb: initial USB Audio Device Class 3.0 support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index 67cf849aa16b..f7179ce39a19 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -968,6 +968,12 @@ snd_usb_get_audioformat_uac3(struct snd_usb_audio *chip,
* and request Cluster Descriptor
*/
wLength = le16_to_cpu(hc_header.wLength);
+ if (wLength < sizeof(*cluster)) {
+ dev_err(&dev->dev,
+ "%u:%d : cluster header size too small %d\n",
+ iface_no, altno, wLength);
+ return ERR_PTR(-EIO);
+ }
cluster = kzalloc(wLength, GFP_KERNEL);
if (!cluster)
return ERR_PTR(-ENOMEM);
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jaroslav Kysela <perex@perex.cz>,
Ruslan Bilovol <ruslan.bilovol@gmail.com>
Cc: Takashi Iwai <tiwai@suse.com>,
Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Michael Drake <michael.drake@codethink.co.uk>,
alsa-devel@alsa-project.org, linux-usb@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: ALSA: usb-audio: ensure that cluster header size is enough
Date: Sat, 22 Sep 2018 16:38:32 +0300 [thread overview]
Message-ID: <20180922133831.GA6792@mwanda> (raw)
I think we need a check to make sure that "hc_header.wLength" is large
enough for a struct struct uac3_cluster_header_descriptor.
Fixes: 9a2fe9b801f5 ("ALSA: usb: initial USB Audio Device Class 3.0 support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index 67cf849aa16b..f7179ce39a19 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -968,6 +968,12 @@ snd_usb_get_audioformat_uac3(struct snd_usb_audio *chip,
* and request Cluster Descriptor
*/
wLength = le16_to_cpu(hc_header.wLength);
+ if (wLength < sizeof(*cluster)) {
+ dev_err(&dev->dev,
+ "%u:%d : cluster header size too small %d\n",
+ iface_no, altno, wLength);
+ return ERR_PTR(-EIO);
+ }
cluster = kzalloc(wLength, GFP_KERNEL);
if (!cluster)
return ERR_PTR(-ENOMEM);
next reply other threads:[~2018-09-22 13:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-22 13:38 Dan Carpenter [this message]
2018-09-22 13:38 ` ALSA: usb-audio: ensure that cluster header size is enough Dan Carpenter
2018-09-22 13:38 ` [PATCH] " Dan Carpenter
2018-09-22 17:13 ` Sergei Shtylyov
2018-09-22 17:13 ` Sergei Shtylyov
2018-09-22 17:13 ` [PATCH] " Sergei Shtylyov
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=20180922133831.GA6792@mwanda \
--to=dan.carpenter@oracle.com \
--cc=alsa-devel@alsa-project.org \
--cc=gregkh@linuxfoundation.org \
--cc=jorge.sanjuan@codethink.co.uk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=michael.drake@codethink.co.uk \
--cc=perex@perex.cz \
--cc=ruslan.bilovol@gmail.com \
--cc=tiwai@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.