diff options
-rw-r--r-- | sound/usb/clock.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sound/usb/clock.c b/sound/usb/clock.c index 30cfd5b1bdfb..0b030d8fe3fa 100644 --- a/sound/usb/clock.c +++ b/sound/usb/clock.c | |||
@@ -58,7 +58,7 @@ static bool validate_clock_source_v2(void *p, int id) | |||
58 | static bool validate_clock_source_v3(void *p, int id) | 58 | static bool validate_clock_source_v3(void *p, int id) |
59 | { | 59 | { |
60 | struct uac3_clock_source_descriptor *cs = p; | 60 | struct uac3_clock_source_descriptor *cs = p; |
61 | return cs->bClockID == id; | 61 | return cs->bLength == sizeof(*cs) && cs->bClockID == id; |
62 | } | 62 | } |
63 | 63 | ||
64 | static bool validate_clock_selector_v2(void *p, int id) | 64 | static bool validate_clock_selector_v2(void *p, int id) |
@@ -71,7 +71,8 @@ static bool validate_clock_selector_v2(void *p, int id) | |||
71 | static bool validate_clock_selector_v3(void *p, int id) | 71 | static bool validate_clock_selector_v3(void *p, int id) |
72 | { | 72 | { |
73 | struct uac3_clock_selector_descriptor *cs = p; | 73 | struct uac3_clock_selector_descriptor *cs = p; |
74 | return cs->bClockID == id; | 74 | return cs->bLength >= sizeof(*cs) && cs->bClockID == id && |
75 | cs->bLength == 11 + cs->bNrInPins; | ||
75 | } | 76 | } |
76 | 77 | ||
77 | static bool validate_clock_multiplier_v2(void *p, int id) | 78 | static bool validate_clock_multiplier_v2(void *p, int id) |
@@ -83,7 +84,7 @@ static bool validate_clock_multiplier_v2(void *p, int id) | |||
83 | static bool validate_clock_multiplier_v3(void *p, int id) | 84 | static bool validate_clock_multiplier_v3(void *p, int id) |
84 | { | 85 | { |
85 | struct uac3_clock_multiplier_descriptor *cs = p; | 86 | struct uac3_clock_multiplier_descriptor *cs = p; |
86 | return cs->bClockID == id; | 87 | return cs->bLength == sizeof(*cs) && cs->bClockID == id; |
87 | } | 88 | } |
88 | 89 | ||
89 | #define DEFINE_FIND_HELPER(name, obj, validator, type) \ | 90 | #define DEFINE_FIND_HELPER(name, obj, validator, type) \ |