aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/key.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/keys/key.c')
-rw-r--r--security/keys/key.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/security/keys/key.c b/security/keys/key.c
index 70eacbe5abde..ac9326c5f1da 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -20,7 +20,7 @@
20#include <linux/err.h> 20#include <linux/err.h>
21#include "internal.h" 21#include "internal.h"
22 22
23static kmem_cache_t *key_jar; 23static struct kmem_cache *key_jar;
24struct rb_root key_serial_tree; /* tree of keys indexed by serial */ 24struct rb_root key_serial_tree; /* tree of keys indexed by serial */
25DEFINE_SPINLOCK(key_serial_lock); 25DEFINE_SPINLOCK(key_serial_lock);
26 26
@@ -285,16 +285,14 @@ struct key *key_alloc(struct key_type *type, const char *desc,
285 } 285 }
286 286
287 /* allocate and initialise the key and its description */ 287 /* allocate and initialise the key and its description */
288 key = kmem_cache_alloc(key_jar, SLAB_KERNEL); 288 key = kmem_cache_alloc(key_jar, GFP_KERNEL);
289 if (!key) 289 if (!key)
290 goto no_memory_2; 290 goto no_memory_2;
291 291
292 if (desc) { 292 if (desc) {
293 key->description = kmalloc(desclen, GFP_KERNEL); 293 key->description = kmemdup(desc, desclen, GFP_KERNEL);
294 if (!key->description) 294 if (!key->description)
295 goto no_memory_3; 295 goto no_memory_3;
296
297 memcpy(key->description, desc, desclen);
298 } 296 }
299 297
300 atomic_set(&key->usage, 1); 298 atomic_set(&key->usage, 1);