aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/control.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /sound/core/control.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'sound/core/control.c')
-rw-r--r--sound/core/control.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index a8b7fabe645e..439ce64f9d82 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -75,7 +75,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
75 ctl->card = card; 75 ctl->card = card;
76 ctl->prefer_pcm_subdevice = -1; 76 ctl->prefer_pcm_subdevice = -1;
77 ctl->prefer_rawmidi_subdevice = -1; 77 ctl->prefer_rawmidi_subdevice = -1;
78 ctl->pid = current->pid; 78 ctl->pid = get_pid(task_pid(current));
79 file->private_data = ctl; 79 file->private_data = ctl;
80 write_lock_irqsave(&card->ctl_files_rwlock, flags); 80 write_lock_irqsave(&card->ctl_files_rwlock, flags);
81 list_add_tail(&ctl->list, &card->ctl_files); 81 list_add_tail(&ctl->list, &card->ctl_files);
@@ -125,6 +125,7 @@ static int snd_ctl_release(struct inode *inode, struct file *file)
125 control->vd[idx].owner = NULL; 125 control->vd[idx].owner = NULL;
126 up_write(&card->controls_rwsem); 126 up_write(&card->controls_rwsem);
127 snd_ctl_empty_read_queue(ctl); 127 snd_ctl_empty_read_queue(ctl);
128 put_pid(ctl->pid);
128 kfree(ctl); 129 kfree(ctl);
129 module_put(card->module); 130 module_put(card->module);
130 snd_card_file_remove(card, file); 131 snd_card_file_remove(card, file);
@@ -236,8 +237,9 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol,
236 access = ncontrol->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE : 237 access = ncontrol->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE :
237 (ncontrol->access & (SNDRV_CTL_ELEM_ACCESS_READWRITE| 238 (ncontrol->access & (SNDRV_CTL_ELEM_ACCESS_READWRITE|
238 SNDRV_CTL_ELEM_ACCESS_INACTIVE| 239 SNDRV_CTL_ELEM_ACCESS_INACTIVE|
239 SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE| 240 SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE|
240 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK)); 241 SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND|
242 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK));
241 kctl.info = ncontrol->info; 243 kctl.info = ncontrol->info;
242 kctl.get = ncontrol->get; 244 kctl.get = ncontrol->get;
243 kctl.put = ncontrol->put; 245 kctl.put = ncontrol->put;
@@ -672,7 +674,7 @@ static int snd_ctl_elem_info(struct snd_ctl_file *ctl,
672 info->access |= SNDRV_CTL_ELEM_ACCESS_LOCK; 674 info->access |= SNDRV_CTL_ELEM_ACCESS_LOCK;
673 if (vd->owner == ctl) 675 if (vd->owner == ctl)
674 info->access |= SNDRV_CTL_ELEM_ACCESS_OWNER; 676 info->access |= SNDRV_CTL_ELEM_ACCESS_OWNER;
675 info->owner = vd->owner_pid; 677 info->owner = pid_vnr(vd->owner->pid);
676 } else { 678 } else {
677 info->owner = -1; 679 info->owner = -1;
678 } 680 }
@@ -827,7 +829,6 @@ static int snd_ctl_elem_lock(struct snd_ctl_file *file,
827 result = -EBUSY; 829 result = -EBUSY;
828 else { 830 else {
829 vd->owner = file; 831 vd->owner = file;
830 vd->owner_pid = current->pid;
831 result = 0; 832 result = 0;
832 } 833 }
833 } 834 }
@@ -858,7 +859,6 @@ static int snd_ctl_elem_unlock(struct snd_ctl_file *file,
858 result = -EPERM; 859 result = -EPERM;
859 else { 860 else {
860 vd->owner = NULL; 861 vd->owner = NULL;
861 vd->owner_pid = 0;
862 result = 0; 862 result = 0;
863 } 863 }
864 } 864 }
@@ -1100,7 +1100,7 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file,
1100 1100
1101 if (copy_from_user(&tlv, _tlv, sizeof(tlv))) 1101 if (copy_from_user(&tlv, _tlv, sizeof(tlv)))
1102 return -EFAULT; 1102 return -EFAULT;
1103 if (tlv.length < sizeof(unsigned int) * 3) 1103 if (tlv.length < sizeof(unsigned int) * 2)
1104 return -EINVAL; 1104 return -EINVAL;
1105 down_read(&card->controls_rwsem); 1105 down_read(&card->controls_rwsem);
1106 kctl = snd_ctl_find_numid(card, tlv.numid); 1106 kctl = snd_ctl_find_numid(card, tlv.numid);
@@ -1120,7 +1120,7 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file,
1120 goto __kctl_end; 1120 goto __kctl_end;
1121 } 1121 }
1122 if (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) { 1122 if (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) {
1123 if (file && vd->owner != NULL && vd->owner != file) { 1123 if (vd->owner != NULL && vd->owner != file) {
1124 err = -EPERM; 1124 err = -EPERM;
1125 goto __kctl_end; 1125 goto __kctl_end;
1126 } 1126 }