aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/control.h4
-rw-r--r--sound/core/control.c5
-rw-r--r--sound/core/pcm.c2
-rw-r--r--sound/core/rawmidi.c2
4 files changed, 8 insertions, 5 deletions
diff --git a/include/sound/control.h b/include/sound/control.h
index 3517745d0a2d..112374dc0c58 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -86,10 +86,12 @@ struct snd_kctl_event {
86 86
87#define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list) 87#define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list)
88 88
89struct pid;
90
89struct snd_ctl_file { 91struct snd_ctl_file {
90 struct list_head list; /* list of all control files */ 92 struct list_head list; /* list of all control files */
91 struct snd_card *card; 93 struct snd_card *card;
92 pid_t pid; 94 struct pid *pid;
93 int prefer_pcm_subdevice; 95 int prefer_pcm_subdevice;
94 int prefer_rawmidi_subdevice; 96 int prefer_rawmidi_subdevice;
95 wait_queue_head_t change_sleep; 97 wait_queue_head_t change_sleep;
diff --git a/sound/core/control.c b/sound/core/control.c
index 814d2cf1a34c..73dc10ac33f6 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);
@@ -672,7 +673,7 @@ static int snd_ctl_elem_info(struct snd_ctl_file *ctl,
672 info->access |= SNDRV_CTL_ELEM_ACCESS_LOCK; 673 info->access |= SNDRV_CTL_ELEM_ACCESS_LOCK;
673 if (vd->owner == ctl) 674 if (vd->owner == ctl)
674 info->access |= SNDRV_CTL_ELEM_ACCESS_OWNER; 675 info->access |= SNDRV_CTL_ELEM_ACCESS_OWNER;
675 info->owner = vd->owner->pid; 676 info->owner = pid_vnr(vd->owner->pid);
676 } else { 677 } else {
677 info->owner = -1; 678 info->owner = -1;
678 } 679 }
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index c69c60b2a48a..8e2c7833614c 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -809,7 +809,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
809 card = pcm->card; 809 card = pcm->card;
810 read_lock(&card->ctl_files_rwlock); 810 read_lock(&card->ctl_files_rwlock);
811 list_for_each_entry(kctl, &card->ctl_files, list) { 811 list_for_each_entry(kctl, &card->ctl_files, list) {
812 if (kctl->pid == current->pid) { 812 if (kctl->pid == task_pid(current)) {
813 prefer_subdevice = kctl->prefer_pcm_subdevice; 813 prefer_subdevice = kctl->prefer_pcm_subdevice;
814 if (prefer_subdevice != -1) 814 if (prefer_subdevice != -1)
815 break; 815 break;
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index c0adc14c91f0..8a81bdafce6e 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -415,7 +415,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
415 subdevice = -1; 415 subdevice = -1;
416 read_lock(&card->ctl_files_rwlock); 416 read_lock(&card->ctl_files_rwlock);
417 list_for_each_entry(kctl, &card->ctl_files, list) { 417 list_for_each_entry(kctl, &card->ctl_files, list) {
418 if (kctl->pid == current->pid) { 418 if (kctl->pid == task_pid(current)) {
419 subdevice = kctl->prefer_rawmidi_subdevice; 419 subdevice = kctl->prefer_rawmidi_subdevice;
420 if (subdevice != -1) 420 if (subdevice != -1)
421 break; 421 break;