diff options
Diffstat (limited to 'security/device_cgroup.c')
-rw-r--r-- | security/device_cgroup.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/security/device_cgroup.c b/security/device_cgroup.c index 46f23971f7e4..9c625f65ee56 100644 --- a/security/device_cgroup.c +++ b/security/device_cgroup.c | |||
@@ -84,13 +84,9 @@ static int dev_whitelist_copy(struct list_head *dest, struct list_head *orig) | |||
84 | struct dev_whitelist_item *wh, *tmp, *new; | 84 | struct dev_whitelist_item *wh, *tmp, *new; |
85 | 85 | ||
86 | list_for_each_entry(wh, orig, list) { | 86 | list_for_each_entry(wh, orig, list) { |
87 | new = kmalloc(sizeof(*wh), GFP_KERNEL); | 87 | new = kmemdup(wh, sizeof(*wh), GFP_KERNEL); |
88 | if (!new) | 88 | if (!new) |
89 | goto free_and_exit; | 89 | goto free_and_exit; |
90 | new->major = wh->major; | ||
91 | new->minor = wh->minor; | ||
92 | new->type = wh->type; | ||
93 | new->access = wh->access; | ||
94 | list_add_tail(&new->list, dest); | 90 | list_add_tail(&new->list, dest); |
95 | } | 91 | } |
96 | 92 | ||
@@ -114,11 +110,10 @@ static int dev_whitelist_add(struct dev_cgroup *dev_cgroup, | |||
114 | { | 110 | { |
115 | struct dev_whitelist_item *whcopy, *walk; | 111 | struct dev_whitelist_item *whcopy, *walk; |
116 | 112 | ||
117 | whcopy = kmalloc(sizeof(*whcopy), GFP_KERNEL); | 113 | whcopy = kmemdup(wh, sizeof(*wh), GFP_KERNEL); |
118 | if (!whcopy) | 114 | if (!whcopy) |
119 | return -ENOMEM; | 115 | return -ENOMEM; |
120 | 116 | ||
121 | memcpy(whcopy, wh, sizeof(*whcopy)); | ||
122 | spin_lock(&dev_cgroup->lock); | 117 | spin_lock(&dev_cgroup->lock); |
123 | list_for_each_entry(walk, &dev_cgroup->whitelist, list) { | 118 | list_for_each_entry(walk, &dev_cgroup->whitelist, list) { |
124 | if (walk->type != wh->type) | 119 | if (walk->type != wh->type) |