]> Git Repo - linux.git/commitdiff
Merge tag 'sound-4.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
authorLinus Torvalds <[email protected]>
Wed, 6 Dec 2017 18:49:14 +0000 (10:49 -0800)
committerLinus Torvalds <[email protected]>
Wed, 6 Dec 2017 18:49:14 +0000 (10:49 -0800)
Pull sound fixes from Takashi Iwai:
 "All fixes are small and for stable:

   - a PCM ioctl race fix

   - yet another USB-audio hardening for malicious descriptors

   - Realtek ALC257 codec support"

* tag 'sound-4.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: pcm: prevent UAF in snd_pcm_info
  ALSA: hda/realtek - New codec support for ALC257
  ALSA: usb-audio: Add check return value for usb_string()
  ALSA: usb-audio: Fix out-of-bound error
  ALSA: seq: Remove spurious WARN_ON() at timer check

1  2 
sound/usb/mixer.c

diff --combined sound/usb/mixer.c
index 61b348383de88fa282028a78603567fa513589b7,afc208e1c756f16bea4349d5fb80f5888bec99ba..7c9e361b2200be081aca8f5a99d1b71a5846d30b
@@@ -204,6 -204,10 +204,10 @@@ static int snd_usb_copy_string_desc(str
                                    int index, char *buf, int maxlen)
  {
        int len = usb_string(state->chip->dev, index, buf, maxlen - 1);
+       if (len < 0)
+               return 0;
        buf[len] = 0;
        return len;
  }
@@@ -1476,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;
                }
@@@ -2174,13 -2178,14 +2178,14 @@@ static int parse_audio_selector_unit(st
        if (len)
                ;
        else if (nameid)
-               snd_usb_copy_string_desc(state, nameid, kctl->id.name,
+               len = snd_usb_copy_string_desc(state, nameid, kctl->id.name,
                                         sizeof(kctl->id.name));
-       else {
+       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));
+       if (!len) {
+               strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name));
  
                if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR)
                        append_ctl_name(kctl, " Clock Source");
This page took 0.067359 seconds and 4 git commands to generate.