All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: ensure that cluster header size is enough
@ 2018-09-22 13:38 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2018-09-22 13:38 UTC (permalink / raw)
  To: Jaroslav Kysela, Ruslan Bilovol
  Cc: alsa-devel, Michael Drake, Greg Kroah-Hartman, linux-usb,
	kernel-janitors, Takashi Iwai, Jorge Sanjuan

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);

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] ALSA: usb-audio: ensure that cluster header size is enough
@ 2018-09-22 13:38 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2018-09-22 13:38 UTC (permalink / raw)
  To: Jaroslav Kysela, Ruslan Bilovol
  Cc: alsa-devel, Michael Drake, Greg Kroah-Hartman, linux-usb,
	kernel-janitors, Takashi Iwai, Jorge Sanjuan

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);

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* ALSA: usb-audio: ensure that cluster header size is enough
@ 2018-09-22 13:38 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2018-09-22 13:38 UTC (permalink / raw)
  To: Jaroslav Kysela, Ruslan Bilovol
  Cc: Takashi Iwai, Jorge Sanjuan, Greg Kroah-Hartman, Michael Drake,
	alsa-devel, linux-usb, kernel-janitors

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);

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ALSA: usb-audio: ensure that cluster header size is enough
  2018-09-22 13:38 ` [PATCH] " Dan Carpenter
  (?)
@ 2018-09-22 17:13   ` Sergei Shtylyov
  -1 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2018-09-22 17:13 UTC (permalink / raw)
  To: Dan Carpenter, Jaroslav Kysela, Ruslan Bilovol
  Cc: alsa-devel, Michael Drake, Greg Kroah-Hartman, linux-usb,
	kernel-janitors, Takashi Iwai, Jorge Sanjuan

Hello!

On 09/22/2018 04:38 PM, Dan Carpenter wrote:

> I think we need a check to make sure that "hc_header.wLength" is large
> enough for a struct struct uac3_cluster_header_descriptor.

   struct struct? :-)

> Fixes: 9a2fe9b801f5 ("ALSA: usb: initial USB Audio Device Class 3.0 support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ALSA: usb-audio: ensure that cluster header size is enough
@ 2018-09-22 17:13   ` Sergei Shtylyov
  0 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2018-09-22 17:13 UTC (permalink / raw)
  To: Dan Carpenter, Jaroslav Kysela, Ruslan Bilovol
  Cc: alsa-devel, Michael Drake, Greg Kroah-Hartman, linux-usb,
	kernel-janitors, Takashi Iwai, Jorge Sanjuan

Hello!

On 09/22/2018 04:38 PM, Dan Carpenter wrote:

> I think we need a check to make sure that "hc_header.wLength" is large
> enough for a struct struct uac3_cluster_header_descriptor.

   struct struct? :-)

> Fixes: 9a2fe9b801f5 ("ALSA: usb: initial USB Audio Device Class 3.0 support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 6+ messages in thread

* ALSA: usb-audio: ensure that cluster header size is enough
@ 2018-09-22 17:13   ` Sergei Shtylyov
  0 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2018-09-22 17:13 UTC (permalink / raw)
  To: Dan Carpenter, Jaroslav Kysela, Ruslan Bilovol
  Cc: Takashi Iwai, Jorge Sanjuan, Greg Kroah-Hartman, Michael Drake,
	alsa-devel, linux-usb, kernel-janitors

Hello!

On 09/22/2018 04:38 PM, Dan Carpenter wrote:

> I think we need a check to make sure that "hc_header.wLength" is large
> enough for a struct struct uac3_cluster_header_descriptor.

   struct struct? :-)

> Fixes: 9a2fe9b801f5 ("ALSA: usb: initial USB Audio Device Class 3.0 support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-09-22 17:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-22 13:38 [PATCH] ALSA: usb-audio: ensure that cluster header size is enough Dan Carpenter
2018-09-22 13:38 ` 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

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.