diff options
Diffstat (limited to 'sound/usb/mixer.c')
-rw-r--r-- | sound/usb/mixer.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index ed4d89c8b52a..e90daf8cdaa8 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -1331,16 +1331,23 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void | |||
1331 | } | 1331 | } |
1332 | channels = (hdr->bLength - 7) / csize - 1; | 1332 | channels = (hdr->bLength - 7) / csize - 1; |
1333 | bmaControls = hdr->bmaControls; | 1333 | bmaControls = hdr->bmaControls; |
1334 | if (hdr->bLength < 7 + csize) { | ||
1335 | snd_printk(KERN_ERR "usbaudio: unit %u: " | ||
1336 | "invalid UAC_FEATURE_UNIT descriptor\n", | ||
1337 | unitid); | ||
1338 | return -EINVAL; | ||
1339 | } | ||
1334 | } else { | 1340 | } else { |
1335 | struct uac2_feature_unit_descriptor *ftr = _ftr; | 1341 | struct uac2_feature_unit_descriptor *ftr = _ftr; |
1336 | csize = 4; | 1342 | csize = 4; |
1337 | channels = (hdr->bLength - 6) / 4 - 1; | 1343 | channels = (hdr->bLength - 6) / 4 - 1; |
1338 | bmaControls = ftr->bmaControls; | 1344 | bmaControls = ftr->bmaControls; |
1339 | } | 1345 | if (hdr->bLength < 6 + csize) { |
1340 | 1346 | snd_printk(KERN_ERR "usbaudio: unit %u: " | |
1341 | if (hdr->bLength < 7 || !csize || hdr->bLength < 7 + csize) { | 1347 | "invalid UAC_FEATURE_UNIT descriptor\n", |
1342 | snd_printk(KERN_ERR "usbaudio: unit %u: invalid UAC_FEATURE_UNIT descriptor\n", unitid); | 1348 | unitid); |
1343 | return -EINVAL; | 1349 | return -EINVAL; |
1350 | } | ||
1344 | } | 1351 | } |
1345 | 1352 | ||
1346 | /* parse the source unit */ | 1353 | /* parse the source unit */ |