]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ALSA: usb-audio: Fix endianess in descriptor validation
authorTakashi Iwai <tiwai@suse.de>
Sat, 1 Feb 2020 08:05:28 +0000 (09:05 +0100)
committerTakashi Iwai <tiwai@suse.de>
Sat, 1 Feb 2020 08:06:11 +0000 (09:06 +0100)
I overlooked that some fields are words and need the converts from
LE in the recently added USB descriptor validation code.
This patch fixes those with the proper macro usages.

Fixes: 57f8770620e9 ("ALSA: usb-audio: More validations of descriptor units")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200201080530.22390-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/validate.c

index 4034c20724155dd489d811a13c3bc8e788392916..6fe206f6e91105c05b09b190fc1dfe15b51352dc 100644 (file)
@@ -110,7 +110,7 @@ static bool validate_processing_unit(const void *p,
        default:
                if (v->type == UAC1_EXTENSION_UNIT)
                        return true; /* OK */
-               switch (d->wProcessType) {
+               switch (le16_to_cpu(d->wProcessType)) {
                case UAC_PROCESS_UP_DOWNMIX:
                case UAC_PROCESS_DOLBY_PROLOGIC:
                        if (d->bLength < len + 1) /* bNrModes */
@@ -125,7 +125,7 @@ static bool validate_processing_unit(const void *p,
        case UAC_VERSION_2:
                if (v->type == UAC2_EXTENSION_UNIT_V2)
                        return true; /* OK */
-               switch (d->wProcessType) {
+               switch (le16_to_cpu(d->wProcessType)) {
                case UAC2_PROCESS_UP_DOWNMIX:
                case UAC2_PROCESS_DOLBY_PROLOCIC: /* SiC! */
                        if (d->bLength < len + 1) /* bNrModes */
@@ -142,7 +142,7 @@ static bool validate_processing_unit(const void *p,
                        len += 2; /* wClusterDescrID */
                        break;
                }
-               switch (d->wProcessType) {
+               switch (le16_to_cpu(d->wProcessType)) {
                case UAC3_PROCESS_UP_DOWNMIX:
                        if (d->bLength < len + 1) /* bNrModes */
                                return false;