ALSA: usb-audio: Fix out of bounds reads when finding clock sources
The current USB-audio driver code doesn't check bLength of each descriptor at traversing for clock descriptors. That is, when a device provides a bogus descriptor with a shorter bLength, the driver might hit out-of-bounds reads. For addressing it, this patch adds sanity checks to the validator functions for the clock descriptor traversal. When the descriptor length is shorter than expected, it's skipped in the loop. For the clock source and clock multiplier descriptors, we can just check bLength against the sizeof() of each descriptor type. OTOH, the clock selector descriptor of UAC2 and UAC3 has an array of bNrInPins elements and two more fields at its tail, hence those have to be checked in addition to the sizeof() check. Reported-by:Benoît Sevens <bsevens@google.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/20241121140613.3651-1-bsevens@google.com Link: https://patch.msgid.link/20241125144629.20757-1-tiwai@suse.de Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
mentioned in commit 45a92cbc
-
mentioned in commit a632bdcb
-
mentioned in commit 01c19aa8
-
mentioned in commit 5072dc52
-
mentioned in commit 3348bc38
-
mentioned in commit 5415f35f
-
mentioned in commit dfbbe15b
-
mentioned in commit f9aca418
-
mentioned in commit d0e1b23b
-
mentioned in commit 5346f479
-
mentioned in commit clo/le/platform/mhi-host@3cbca2b0
-
mentioned in commit common@dc864fbc
Please register or sign in to comment