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 b1dea100
-
mentioned in commit b9a97ffe
-
mentioned in commit 6fc71d5a
-
mentioned in commit d0e1b23b
-
mentioned in commit 3cbca2b0
-
mentioned in commit 3d1fea7e
-
mentioned in commit 4f87ec8f
-
mentioned in commit d1b56944
-
mentioned in commit 6bd3bb4d
-
mentioned in commit 78bdb24d
-
mentioned in commit 8d1040e1
-
mentioned in commit 5188a1c3
-
mentioned in commit 4976eac3
-
mentioned in commit cf582d88
-
mentioned in commit 2f200409
-
mentioned in commit 5415f35f
-
mentioned in commit 21a574b6
-
mentioned in commit bdedff6f
-
mentioned in commit a1900607
-
mentioned in commit 07a8aec1
-
mentioned in commit 82f7374b
-
mentioned in commit 996f9387
-
mentioned in commit b1f32b31
-
mentioned in commit dfbbe15b
-
mentioned in commit 2a238ca3
-
mentioned in commit 7630ebad
-
mentioned in commit 5724062e
-
mentioned in commit 68e3e6a7
-
mentioned in commit e3ecbbb3
-
mentioned in commit a411049c
-
mentioned in commit a70be9f6
-
mentioned in commit f9aca418
-
mentioned in commit f8eae0d5
-
mentioned in commit de97aef3
-
mentioned in commit 96c735b8
-
mentioned in commit f4d9c95d
-
mentioned in commit b0501dbb
-
mentioned in commit 13ce391c
-
mentioned in commit dc864fbc
-
mentioned in commit dcfec89a
-
mentioned in commit d84337ba
-
mentioned in commit 6777fd9b
-
mentioned in commit 1e62ea60
-
mentioned in commit bb8d8b4e