diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-08-20 18:17:09 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-11-12 21:27:24 +0300 |
commit | bf74a46aebb1b5ab5e5f25bafa4ae0a453ba813a (patch) | |
tree | 39fa95b2acfcb13aba4a90caa53e599d26e0c7a4 /sound/usb/power.c | |
parent | 858c35c6ad0f049f6c13853b874c59165499f7df (diff) | |
download | linux-bf74a46aebb1b5ab5e5f25bafa4ae0a453ba813a.tar.xz |
ALSA: usb-audio: More validations of descriptor units
commit 57f8770620e9b51c61089751f0b5ad3dbe376ff2 upstream.
Introduce a new helper to validate each audio descriptor unit before
and check the unit before actually accessing it. This should harden
against the OOB access cases with malformed descriptors that have been
recently frequently reported by fuzzers.
The existing descriptor checks are still kept although they become
superfluous after this patch. They'll be cleaned up eventually
later.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/usb/power.c')
-rw-r--r-- | sound/usb/power.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/usb/power.c b/sound/usb/power.c index bd303a1ba1b7..606a2cb23eab 100644 --- a/sound/usb/power.c +++ b/sound/usb/power.c @@ -31,6 +31,8 @@ snd_usb_find_power_domain(struct usb_host_interface *ctrl_iface, struct uac3_power_domain_descriptor *pd_desc = p; int i; + if (!snd_usb_validate_audio_desc(p, UAC_VERSION_3)) + continue; for (i = 0; i < pd_desc->bNrEntities; i++) { if (pd_desc->baEntityID[i] == id) { pd->pd_id = pd_desc->bPowerDomainID; |