Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6.25
[sfrench/cifs-2.6.git] / security / keys / keyring.c
index e8d02acc51e7180f23a31b849ccce820418fd55c..88292e3dee966103fff3f4a9e1cba7b5d22fc5c9 100644 (file)
@@ -66,6 +66,8 @@ struct key_type key_type_keyring = {
        .read           = keyring_read,
 };
 
+EXPORT_SYMBOL(key_type_keyring);
+
 /*
  * semaphore to serialise link/link calls to prevent two link calls in parallel
  * introducing a cycle
@@ -706,12 +708,10 @@ int __key_link(struct key *keyring, struct key *key)
                                BUG_ON(size > PAGE_SIZE);
 
                                ret = -ENOMEM;
-                               nklist = kmalloc(size, GFP_KERNEL);
+                               nklist = kmemdup(klist, size, GFP_KERNEL);
                                if (!nklist)
                                        goto error2;
 
-                               memcpy(nklist, klist, size);
-
                                /* replace matched key */
                                atomic_inc(&key->usage);
                                nklist->keys[loop] = key;