control: use reference-counted pid
Instead of storing the PID number, take a reference to the task's pid structure. This protects against duplicates due to PID overflows, and using pid_vnr() ensures that the PID returned by snd_ctl_elem_info() is correct as seen from the current namespace. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
committed by
Takashi Iwai
parent
31cef7076e
commit
25d27eded1
@@ -415,7 +415,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
|
||||
subdevice = -1;
|
||||
read_lock(&card->ctl_files_rwlock);
|
||||
list_for_each_entry(kctl, &card->ctl_files, list) {
|
||||
if (kctl->pid == current->pid) {
|
||||
if (kctl->pid == task_pid(current)) {
|
||||
subdevice = kctl->prefer_rawmidi_subdevice;
|
||||
if (subdevice != -1)
|
||||
break;
|
||||
|
Reference in New Issue
Block a user