keys: PTR_ERR return of wrong pointer in keyctl_get_security()
[safe/jmp/linux-2.6] / security / keys / keyctl.c
index 2fb28ef..5f830bc 100644 (file)
@@ -873,7 +873,7 @@ static long get_instantiation_keyring(key_serial_t ringid,
        /* otherwise specify the destination keyring recorded in the
         * authorisation key (any KEY_SPEC_*_KEYRING) */
        if (ringid >= KEY_SPEC_REQUESTOR_KEYRING) {
-               *_dest_keyring = rka->dest_keyring;
+               *_dest_keyring = key_get(rka->dest_keyring);
                return 0;
        }
 
@@ -1194,7 +1194,7 @@ long keyctl_get_security(key_serial_t keyid,
                 * have the authorisation token handy */
                instkey = key_get_instantiation_authkey(keyid);
                if (IS_ERR(instkey))
-                       return PTR_ERR(key_ref);
+                       return PTR_ERR(instkey);
                key_put(instkey);
 
                key_ref = lookup_user_key(keyid, KEY_LOOKUP_PARTIAL, 0);