OSDN Git Service

ALSA: usb-audio: Fix potential out-of-bound access at parsing SU
authorTakashi Iwai <tiwai@suse.de>
Tue, 21 Nov 2017 16:00:32 +0000 (17:00 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Nov 2017 08:37:21 +0000 (08:37 +0000)
commit0b6cede2e45500452c5c49d9cfb7d10cb1aca437
tree5aed9c2176626a242ae246af6f134958f0a62ee3
parentd1316b9d83de1f0ce969206aaa5d3a1a60dc5c37
ALSA: usb-audio: Fix potential out-of-bound access at parsing SU

commit f658f17b5e0e339935dca23e77e0f3cad591926b upstream.

The usb-audio driver may trigger an out-of-bound access at parsing a
malformed selector unit, as it checks the header length only after
evaluating bNrInPins field, which can be already above the given
length.  Fix it by adding the length check beforehand.

Fixes: 99fc86450c43 ("ALSA: usb-mixer: parse descriptors with structs")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/usb/mixer.c