aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2009-08-17 06:28:09 -0400
committerTakashi Iwai <tiwai@suse.de>2009-08-17 06:48:21 -0400
commit18dd0aa5afea7dc33953aa87de696e39074bbf78 (patch)
tree59c3304f340c8ba180002c99c8961b388bf84fb0
parentf217ac59b6dd73105abc13da3fe656391fa6d135 (diff)
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>
-rw-r--r--sound/core/control.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index bc64b723415b..a8b7fabe645e 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -436,6 +436,10 @@ static int snd_ctl_remove_user_ctl(struct snd_ctl_file * file,
436 ret = -ENOENT; 436 ret = -ENOENT;
437 goto error; 437 goto error;
438 } 438 }
439 if (!(kctl->vd[0].access & SNDRV_CTL_ELEM_ACCESS_USER)) {
440 ret = -EINVAL;
441 goto error;
442 }
439 for (idx = 0; idx < kctl->count; idx++) 443 for (idx = 0; idx < kctl->count; idx++)
440 if (kctl->vd[idx].owner != NULL && kctl->vd[idx].owner != file) { 444 if (kctl->vd[idx].owner != NULL && kctl->vd[idx].owner != file) {
441 ret = -EBUSY; 445 ret = -EBUSY;