aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/keyring.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/keys/keyring.c')
-rw-r--r--security/keys/keyring.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index e8d02acc51e7..ad45ce73964b 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -706,12 +706,10 @@ int __key_link(struct key *keyring, struct key *key)
706 BUG_ON(size > PAGE_SIZE); 706 BUG_ON(size > PAGE_SIZE);
707 707
708 ret = -ENOMEM; 708 ret = -ENOMEM;
709 nklist = kmalloc(size, GFP_KERNEL); 709 nklist = kmemdup(klist, size, GFP_KERNEL);
710 if (!nklist) 710 if (!nklist)
711 goto error2; 711 goto error2;
712 712
713 memcpy(nklist, klist, size);
714
715 /* replace matched key */ 713 /* replace matched key */
716 atomic_inc(&key->usage); 714 atomic_inc(&key->usage);
717 nklist->keys[loop] = key; 715 nklist->keys[loop] = key;