Linux cgroups development
 help / color / mirror / Atom feed
From: Aristeu Rozanski <aris-moeOTchvdi7YtjvyW6yDsg@public.gmane.org>
To: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
	aris-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Subject: [PATCH 2/4] device_cgroup: introduce dev_whitelist_clean()
Date: Tue, 24 Jul 2012 18:03:35 -0400	[thread overview]
Message-ID: <20120724220334.533842795@muttley.lan.cathedral> (raw)
In-Reply-To: 20120724220333.966415895@muttley.lan.cathedral

[-- Attachment #1: introduce_whitelist_clean.patch --]
[-- Type: text/plain, Size: 1391 bytes --]

This function cleans all the items in a whitelist and will be used by the next
patches.

Signed-off-by: Aristeu Rozanski <aris-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

---
 security/device_cgroup.c |   22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

Index: github/security/device_cgroup.c
===================================================================
--- github.orig/security/device_cgroup.c	2012-07-24 17:16:00.085156162 -0400
+++ github/security/device_cgroup.c	2012-07-24 17:58:42.984081909 -0400
@@ -154,6 +154,22 @@
 	}
 }
 
+/**
+ * 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.
  */
@@ -200,13 +216,9 @@
 static void devcgroup_destroy(struct cgroup *cgroup)
 {
 	struct dev_cgroup *dev_cgroup;
-	struct dev_whitelist_item *wh, *tmp;
 
 	dev_cgroup = cgroup_to_devcgroup(cgroup);
-	list_for_each_entry_safe(wh, tmp, &dev_cgroup->whitelist, list) {
-		list_del(&wh->list);
-		kfree(wh);
-	}
+	dev_whitelist_clean(dev_cgroup);
 	kfree(dev_cgroup);
 }
 

  parent reply	other threads:[~2012-07-24 22:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-24 22:03 [PATCH 0/4] device_cgroup: replace internally whitelist with exception list Aristeu Rozanski
2012-07-24 22:03 ` [PATCH 1/4] device_cgroup: add "deny_all" in dev_cgroup structure Aristeu Rozanski
2012-07-24 22:03 ` Aristeu Rozanski [this message]
2012-07-24 22:03 ` [PATCH 3/4] device_cgroup: convert device_cgroup internally to policy + exceptions Aristeu Rozanski
2012-07-24 22:03 ` [PATCH 4/4] device_cgroup: rename whitelist to exception list Aristeu Rozanski
     [not found] ` <20120724220333.966415895-+5JutNtNrJPwzbzh4h2Q61C45dnP8DBc@public.gmane.org>
2012-07-30 14:51   ` [PATCH 0/4] device_cgroup: replace internally whitelist with " Aristeu Rozanski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120724220334.533842795@muttley.lan.cathedral \
    --to=aris-moeotchvdi7ytjvyw6ydsg@public.gmane.org \
    --cc=aris-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox