提交 755bc613 编写于 作者: T Takashi Iwai 提交者: Xie XiuQi

ALSA: usb-audio: Fix incorrect size check for processing/extension units

commit 976a68f06b2ea49e2ab67a5f84919a8b105db8be upstream.

The recently introduced unit descriptor validation had some bug for
processing and extension units, it counts a bControlSize byte twice so
it expected a bigger size than it should have been.  This seems
resulting in a probe error on a few devices.

Fix the calculation for proper checks of PU and EU.

Fixes: 57f8770620e9 ("ALSA: usb-audio: More validations of descriptor units")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191114165613.7422-1-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 ed77901a
...@@ -81,9 +81,9 @@ static bool validate_processing_unit(const void *p, ...@@ -81,9 +81,9 @@ static bool validate_processing_unit(const void *p,
switch (v->protocol) { switch (v->protocol) {
case UAC_VERSION_1: case UAC_VERSION_1:
default: default:
/* bNrChannels, wChannelConfig, iChannelNames, bControlSize */ /* bNrChannels, wChannelConfig, iChannelNames */
len += 1 + 2 + 1 + 1; len += 1 + 2 + 1;
if (d->bLength < len) /* bControlSize */ if (d->bLength < len + 1) /* bControlSize */
return false; return false;
m = hdr[len]; m = hdr[len];
len += 1 + m + 1; /* bControlSize, bmControls, iProcessing */ len += 1 + m + 1; /* bControlSize, bmControls, iProcessing */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册