mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-11 11:09:13 +00:00
ALSA: usb-audio: Fix potential out-of-bound access at parsing SU
commitf658f17b5e
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:99fc86450c
("ALSA: usb-mixer: parse descriptors with structs") Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7a0e3e553e
commit
5f7873c994
1 changed files with 2 additions and 1 deletions
|
@ -2098,7 +2098,8 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid,
|
|||
const struct usbmix_name_map *map;
|
||||
char **namelist;
|
||||
|
||||
if (!desc->bNrInPins || desc->bLength < 5 + desc->bNrInPins) {
|
||||
if (desc->bLength < 5 || !desc->bNrInPins ||
|
||||
desc->bLength < 5 + desc->bNrInPins) {
|
||||
usb_audio_err(state->chip,
|
||||
"invalid SELECTOR UNIT descriptor %d\n", unitid);
|
||||
return -EINVAL;
|
||||
|
|
Loading…
Reference in a new issue