mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-26 18:43:33 -05:00
sound: snd_ctl_remove_user_ctl: prevent removal of kernel controls
Ensure that userspace can remove only user controls. Controls created by kernel drivers must not be removed because they might be referenced in calls to snd_ctl_notify(). Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
f217ac59b6
commit
18dd0aa5af
1 changed files with 4 additions and 0 deletions
|
@ -436,6 +436,10 @@ static int snd_ctl_remove_user_ctl(struct snd_ctl_file * file,
|
|||
ret = -ENOENT;
|
||||
goto error;
|
||||
}
|
||||
if (!(kctl->vd[0].access & SNDRV_CTL_ELEM_ACCESS_USER)) {
|
||||
ret = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
for (idx = 0; idx < kctl->count; idx++)
|
||||
if (kctl->vd[idx].owner != NULL && kctl->vd[idx].owner != file) {
|
||||
ret = -EBUSY;
|
||||
|
|
Loading…
Add table
Reference in a new issue