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>
This commit is contained in:
parent
66b8ef6775
commit
868539a3b6
1 changed files with 17 additions and 5 deletions
|
@ -154,6 +154,22 @@ static void dev_whitelist_rm(struct dev_cgroup *dev_cgroup,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dev_whitelist_clean - frees all entries of the whitelist
|
||||||
|
* @dev_cgroup: dev_cgroup with the whitelist to be cleaned
|
||||||
|
*
|
||||||
|
* called under devcgroup_mutex
|
||||||
|
*/
|
||||||
|
static void dev_whitelist_clean(struct dev_cgroup *dev_cgroup)
|
||||||
|
{
|
||||||
|
struct dev_whitelist_item *wh, *tmp;
|
||||||
|
|
||||||
|
list_for_each_entry_safe(wh, tmp, &dev_cgroup->whitelist, list) {
|
||||||
|
list_del(&wh->list);
|
||||||
|
kfree(wh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* called from kernel/cgroup.c with cgroup_lock() held.
|
* called from kernel/cgroup.c with cgroup_lock() held.
|
||||||
*/
|
*/
|
||||||
|
@ -200,13 +216,9 @@ static struct cgroup_subsys_state *devcgroup_create(struct cgroup *cgroup)
|
||||||
static void devcgroup_destroy(struct cgroup *cgroup)
|
static void devcgroup_destroy(struct cgroup *cgroup)
|
||||||
{
|
{
|
||||||
struct dev_cgroup *dev_cgroup;
|
struct dev_cgroup *dev_cgroup;
|
||||||
struct dev_whitelist_item *wh, *tmp;
|
|
||||||
|
|
||||||
dev_cgroup = cgroup_to_devcgroup(cgroup);
|
dev_cgroup = cgroup_to_devcgroup(cgroup);
|
||||||
list_for_each_entry_safe(wh, tmp, &dev_cgroup->whitelist, list) {
|
dev_whitelist_clean(dev_cgroup);
|
||||||
list_del(&wh->list);
|
|
||||||
kfree(wh);
|
|
||||||
}
|
|
||||||
kfree(dev_cgroup);
|
kfree(dev_cgroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue