aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/mixer.c')
-rw-r--r--sound/usb/mixer.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 1d369e2bd2e..4d68f90b848 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1238,16 +1238,23 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
1238 } 1238 }
1239 channels = (hdr->bLength - 7) / csize - 1; 1239 channels = (hdr->bLength - 7) / csize - 1;
1240 bmaControls = hdr->bmaControls; 1240 bmaControls = hdr->bmaControls;
1241 if (hdr->bLength < 7 + csize) {
1242 snd_printk(KERN_ERR "usbaudio: unit %u: "
1243 "invalid UAC_FEATURE_UNIT descriptor\n",
1244 unitid);
1245 return -EINVAL;
1246 }
1241 } else { 1247 } else {
1242 struct uac2_feature_unit_descriptor *ftr = _ftr; 1248 struct uac2_feature_unit_descriptor *ftr = _ftr;
1243 csize = 4; 1249 csize = 4;
1244 channels = (hdr->bLength - 6) / 4 - 1; 1250 channels = (hdr->bLength - 6) / 4 - 1;
1245 bmaControls = ftr->bmaControls; 1251 bmaControls = ftr->bmaControls;
1246 } 1252 if (hdr->bLength < 6 + csize) {
1247 1253 snd_printk(KERN_ERR "usbaudio: unit %u: "
1248 if (hdr->bLength < 7 || !csize || hdr->bLength < 7 + csize) { 1254 "invalid UAC_FEATURE_UNIT descriptor\n",
1249 snd_printk(KERN_ERR "usbaudio: unit %u: invalid UAC_FEATURE_UNIT descriptor\n", unitid); 1255 unitid);
1250 return -EINVAL; 1256 return -EINVAL;
1257 }
1251 } 1258 }
1252 1259
1253 /* parse the source unit */ 1260 /* parse the source unit */