Merge branch 'for-linus' into for-next
authorTakashi Iwai <tiwai@suse.de>
Thu, 12 Mar 2015 06:38:46 +0000 (07:38 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 12 Mar 2015 06:38:46 +0000 (07:38 +0100)
1  2 
sound/core/control.c

index 833b223a363a0324b20eae0adf204242f43ea114,eeb691d1911f5716bb09b8eecacd24215a31564f..54a412af32241cd5d377612633bd2cf80d0aca33
@@@ -1205,11 -1166,22 +1205,16 @@@ static int snd_ctl_elem_add(struct snd_
        unsigned int access;
        long private_size;
        struct user_element *ue;
 -      int idx, err;
 +      int err;
  
 -      if (info->count < 1)
 -              return -EINVAL;
+       if (!*info->id.name)
+               return -EINVAL;
+       if (strnlen(info->id.name, sizeof(info->id.name)) >= sizeof(info->id.name))
+               return -EINVAL;
 -      access = info->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE :
 -              (info->access & (SNDRV_CTL_ELEM_ACCESS_READWRITE|
 -                               SNDRV_CTL_ELEM_ACCESS_INACTIVE|
 -                               SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE));
 -      info->id.numid = 0;
 -      memset(&kctl, 0, sizeof(kctl));
 +      /* Delete a control to replace them if needed. */
        if (replace) {
 +              info->id.numid = 0;
                err = snd_ctl_remove_user_ctl(file, &info->id);
                if (err)
                        return err;