diff options
Diffstat (limited to 'security/device_cgroup.c')
-rw-r--r-- | security/device_cgroup.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/security/device_cgroup.c b/security/device_cgroup.c index d794abcc4b3b..1c69e38e3a2c 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, | |||
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | static void __dev_exception_clean(struct dev_cgroup *dev_cgroup) | ||
163 | { | ||
164 | struct dev_exception_item *ex, *tmp; | ||
165 | |||
166 | list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) { | ||
167 | list_del_rcu(&ex->list); | ||
168 | kfree_rcu(ex, rcu); | ||
169 | } | ||
170 | } | ||
171 | |||
162 | /** | 172 | /** |
163 | * dev_exception_clean - frees all entries of the exception list | 173 | * dev_exception_clean - frees all entries of the exception list |
164 | * @dev_cgroup: dev_cgroup with the exception list to be cleaned | 174 | * @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, | |||
167 | */ | 177 | */ |
168 | static void dev_exception_clean(struct dev_cgroup *dev_cgroup) | 178 | static void dev_exception_clean(struct dev_cgroup *dev_cgroup) |
169 | { | 179 | { |
170 | struct dev_exception_item *ex, *tmp; | ||
171 | |||
172 | lockdep_assert_held(&devcgroup_mutex); | 180 | lockdep_assert_held(&devcgroup_mutex); |
173 | 181 | ||
174 | list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) { | 182 | __dev_exception_clean(dev_cgroup); |
175 | list_del_rcu(&ex->list); | ||
176 | kfree_rcu(ex, rcu); | ||
177 | } | ||
178 | } | 183 | } |
179 | 184 | ||
180 | /* | 185 | /* |
@@ -215,9 +220,7 @@ static void devcgroup_css_free(struct cgroup *cgroup) | |||
215 | struct dev_cgroup *dev_cgroup; | 220 | struct dev_cgroup *dev_cgroup; |
216 | 221 | ||
217 | dev_cgroup = cgroup_to_devcgroup(cgroup); | 222 | dev_cgroup = cgroup_to_devcgroup(cgroup); |
218 | mutex_lock(&devcgroup_mutex); | 223 | __dev_exception_clean(dev_cgroup); |
219 | dev_exception_clean(dev_cgroup); | ||
220 | mutex_unlock(&devcgroup_mutex); | ||
221 | kfree(dev_cgroup); | 224 | kfree(dev_cgroup); |
222 | } | 225 | } |
223 | 226 | ||