aboutsummaryrefslogtreecommitdiffstats
path: root/security/device_cgroup.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/device_cgroup.c')
-rw-r--r--security/device_cgroup.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index e3ce02a00ffc..5b36b62e9ff4 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -154,6 +154,22 @@ remove:
154 } 154 }
155} 155}
156 156
157/**
158 * dev_whitelist_clean - frees all entries of the whitelist
159 * @dev_cgroup: dev_cgroup with the whitelist to be cleaned
160 *
161 * called under devcgroup_mutex
162 */
163static void dev_whitelist_clean(struct dev_cgroup *dev_cgroup)
164{
165 struct dev_whitelist_item *wh, *tmp;
166
167 list_for_each_entry_safe(wh, tmp, &dev_cgroup->whitelist, list) {
168 list_del(&wh->list);
169 kfree(wh);
170 }
171}
172
157/* 173/*
158 * called from kernel/cgroup.c with cgroup_lock() held. 174 * called from kernel/cgroup.c with cgroup_lock() held.
159 */ 175 */
@@ -200,13 +216,9 @@ static struct cgroup_subsys_state *devcgroup_create(struct cgroup *cgroup)
200static void devcgroup_destroy(struct cgroup *cgroup) 216static void devcgroup_destroy(struct cgroup *cgroup)
201{ 217{
202 struct dev_cgroup *dev_cgroup; 218 struct dev_cgroup *dev_cgroup;
203 struct dev_whitelist_item *wh, *tmp;
204 219
205 dev_cgroup = cgroup_to_devcgroup(cgroup); 220 dev_cgroup = cgroup_to_devcgroup(cgroup);
206 list_for_each_entry_safe(wh, tmp, &dev_cgroup->whitelist, list) { 221 dev_whitelist_clean(dev_cgroup);
207 list_del(&wh->list);
208 kfree(wh);
209 }
210 kfree(dev_cgroup); 222 kfree(dev_cgroup);
211} 223}
212 224