diff options
| author | Aristeu Rozanski <aris@redhat.com> | 2012-10-04 20:15:15 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-05 14:05:14 -0400 |
| commit | 868539a3b671e0f736ddd11b67bf1dc3d8a5a921 (patch) | |
| tree | 2c2c10e2983c40ffad02fb01d55fad6f4a6b3175 /security | |
| parent | 66b8ef67756b3051bf42a077a82c3c5c279caa5b (diff) | |
device_cgroup: introduce dev_whitelist_clean()
This function cleans all the items in a whitelist and will be used by the next
patches.
Signed-off-by: Aristeu Rozanski <aris@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Li Zefan <lizefan@huawei.com>
Cc: James Morris <jmorris@namei.org>
Cc: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Serge E. Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security')
| -rw-r--r-- | security/device_cgroup.c | 22 |
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 | */ | ||
| 163 | static 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) | |||
| 200 | static void devcgroup_destroy(struct cgroup *cgroup) | 216 | static 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 | ||
