summaryrefslogtreecommitdiffstats
path: root/security/device_cgroup.c
diff options
context:
space:
mode:
authorJerry Snitselaar <jerry.snitselaar@oracle.com>2013-02-21 16:41:31 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-21 17:22:15 -0800
commit53eb8c82d581fdd4b389a3e417261f3ae924e603 (patch)
treede3893156c17c9ab220e4460630f581c55a0f487 /security/device_cgroup.c
parent024e4ec1856d57bb78c06ec903d29dcf716f5f47 (diff)
downloadop-kernel-dev-53eb8c82d581fdd4b389a3e417261f3ae924e603.zip
op-kernel-dev-53eb8c82d581fdd4b389a3e417261f3ae924e603.tar.gz
device_cgroup: don't grab mutex in rcu callback
Commit 103a197c0c4e ("security/device_cgroup: lock assert fails in dev_exception_clean()") grabs devcgroup_mutex to fix assert failure, but a mutex can't be grabbed in rcu callback. Since there shouldn't be any other references when css_free is called, mutex isn't needed for list cleanup in devcgroup_css_free(). Signed-off-by: Jerry Snitselaar <jerry.snitselaar@oracle.com> Acked-by: Tejun Heo <tj@kernel.org> Acked-by: Aristeu Rozanski <aris@redhat.com> Cc: James Morris <james.l.morris@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security/device_cgroup.c')
-rw-r--r--security/device_cgroup.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index d794abc..1c69e38 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -159,6 +159,16 @@ static void dev_exception_rm(struct dev_cgroup *dev_cgroup,
}
}
+static void __dev_exception_clean(struct dev_cgroup *dev_cgroup)
+{
+ struct dev_exception_item *ex, *tmp;
+
+ list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) {
+ list_del_rcu(&ex->list);
+ kfree_rcu(ex, rcu);
+ }
+}
+
/**
* dev_exception_clean - frees all entries of the exception list
* @dev_cgroup: dev_cgroup with the exception list to be cleaned
@@ -167,14 +177,9 @@ static void dev_exception_rm(struct dev_cgroup *dev_cgroup,
*/
static void dev_exception_clean(struct dev_cgroup *dev_cgroup)
{
- struct dev_exception_item *ex, *tmp;
-
lockdep_assert_held(&devcgroup_mutex);
- list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) {
- list_del_rcu(&ex->list);
- kfree_rcu(ex, rcu);
- }
+ __dev_exception_clean(dev_cgroup);
}
/*
@@ -215,9 +220,7 @@ static void devcgroup_css_free(struct cgroup *cgroup)
struct dev_cgroup *dev_cgroup;
dev_cgroup = cgroup_to_devcgroup(cgroup);
- mutex_lock(&devcgroup_mutex);
- dev_exception_clean(dev_cgroup);
- mutex_unlock(&devcgroup_mutex);
+ __dev_exception_clean(dev_cgroup);
kfree(dev_cgroup);
}
OpenPOWER on IntegriCloud