Commit 868539a3b671e0f736ddd11b67bf1dc3d8a5a921
Committed by
Linus Torvalds
1 parent
66b8ef6775
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 1 changed file with 17 additions and 5 deletions Side-by-side Diff
security/device_cgroup.c
... | ... | @@ -154,6 +154,22 @@ |
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 | 174 | * called from kernel/cgroup.c with cgroup_lock() held. |
159 | 175 | */ |
160 | 176 | |
... | ... | @@ -200,13 +216,9 @@ |
200 | 216 | static void devcgroup_destroy(struct cgroup *cgroup) |
201 | 217 | { |
202 | 218 | struct dev_cgroup *dev_cgroup; |
203 | - struct dev_whitelist_item *wh, *tmp; | |
204 | 219 | |
205 | 220 | dev_cgroup = cgroup_to_devcgroup(cgroup); |
206 | - list_for_each_entry_safe(wh, tmp, &dev_cgroup->whitelist, list) { | |
207 | - list_del(&wh->list); | |
208 | - kfree(wh); | |
209 | - } | |
221 | + dev_whitelist_clean(dev_cgroup); | |
210 | 222 | kfree(dev_cgroup); |
211 | 223 | } |
212 | 224 |