Merge tag 'sound-4.15-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 20 Dec 2017 21:03:20 +0000 (13:03 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 20 Dec 2017 21:03:20 +0000 (13:03 -0800)
Pull sound fixes from Takashi Iwai:
 "All stable fixes here:

   - a regression fix of USB-audio for the previous hardening patch

   - a potential UAF fix in rawmidi

   - HD-audio and USB-audio quirks, the missing new ID"

* tag 'sound-4.15-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: usb-audio: Fix the missing ctl name suffix at parsing SU
  ALSA: hda/realtek - Fix Dell AIO LineOut issue
  ALSA: rawmidi: Avoid racy info ioctl via ctl device
  ALSA: hda - Add vendor id for Cannonlake HDMI codec
  ALSA: usb-audio: Add native DSD support for Esoteric D-05X

1  2 
sound/usb/mixer.c

diff --combined sound/usb/mixer.c
index 7c9e361b2200be081aca8f5a99d1b71a5846d30b,60ebc99ae323a122f898476ccb05f3600b66b9d7..2b4ceda36291c01c6cca69d3a1cacd6c23014f40
@@@ -1480,9 -1480,9 +1480,9 @@@ static int parse_audio_feature_unit(str
                        return -EINVAL;
                }
                csize = hdr->bControlSize;
 -              if (csize <= 1) {
 +              if (!csize) {
                        usb_audio_dbg(state->chip,
 -                                    "unit %u: invalid bControlSize <= 1\n",
 +                                    "unit %u: invalid bControlSize == 0\n",
                                      unitid);
                        return -EINVAL;
                }
@@@ -2173,20 -2173,25 +2173,25 @@@ static int parse_audio_selector_unit(st
        kctl->private_value = (unsigned long)namelist;
        kctl->private_free = usb_mixer_selector_elem_free;
  
-       nameid = uac_selector_unit_iSelector(desc);
+       /* check the static mapping table at first */
        len = check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name));
-       if (len)
-               ;
-       else if (nameid)
-               len = snd_usb_copy_string_desc(state, nameid, kctl->id.name,
-                                        sizeof(kctl->id.name));
-       else
-               len = get_term_name(state, &state->oterm,
-                                   kctl->id.name, sizeof(kctl->id.name), 0);
        if (!len) {
-               strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name));
+               /* no mapping ? */
+               /* if iSelector is given, use it */
+               nameid = uac_selector_unit_iSelector(desc);
+               if (nameid)
+                       len = snd_usb_copy_string_desc(state, nameid,
+                                                      kctl->id.name,
+                                                      sizeof(kctl->id.name));
+               /* ... or pick up the terminal name at next */
+               if (!len)
+                       len = get_term_name(state, &state->oterm,
+                                   kctl->id.name, sizeof(kctl->id.name), 0);
+               /* ... or use the fixed string "USB" as the last resort */
+               if (!len)
+                       strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name));
  
+               /* and add the proper suffix */
                if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR)
                        append_ctl_name(kctl, " Clock Source");
                else if ((state->oterm.type & 0xff00) == 0x0100)