lkml.org 
[lkml]   [2013]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH v4 7/9] devcg: split single exception copy from dev_exceptions_copy()
This patch is in preparation for hierarchy support

This patch doesn't introduce any functional changes.

Acked-by: Tejun Heo <tj@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Aristeu Rozanski <aris@redhat.com>

---
security/device_cgroup.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)

--- github.orig/security/device_cgroup.c 2013-01-29 11:49:16.076677425 -0500
+++ github/security/device_cgroup.c 2013-01-29 11:49:16.374681863 -0500
@@ -89,20 +89,30 @@ static int devcgroup_can_attach(struct c
return 0;
}

+static int dev_exception_copy(struct list_head *dest,
+ struct dev_exception_item *ex)
+{
+ struct dev_exception_item *new;
+
+ new = kmemdup(ex, sizeof(*ex), GFP_KERNEL);
+ if (!new)
+ return -ENOMEM;
+ list_add_tail(&new->list, dest);
+ return 0;
+}
+
/*
* called under devcgroup_mutex
*/
static int dev_exceptions_copy(struct list_head *dest, struct list_head *orig)
{
- struct dev_exception_item *ex, *tmp, *new;
+ struct dev_exception_item *ex, *tmp;

lockdep_assert_held(&devcgroup_mutex);

list_for_each_entry(ex, orig, list) {
- new = kmemdup(ex, sizeof(*ex), GFP_KERNEL);
- if (!new)
+ if (dev_exception_copy(dest, ex))
goto free_and_exit;
- list_add_tail(&new->list, dest);
}

return 0;


\
 
 \ /
  Last update: 2013-01-30 19:01    [W:0.237 / U:1.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site