KEYS: Don't return EAGAIN to keyctl_assume_authority()
David Howells [Mon, 13 Jun 2011 21:33:52 +0000 (22:33 +0100)]
Don't return EAGAIN to keyctl_assume_authority() to indicate that a key could
not be found (ENOKEY is only returned if a negative key is found).  Instead
return ENOKEY in both cases.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>

security/keys/request_key_auth.c

index 6cff375..60d4e3f 100644 (file)
@@ -251,6 +251,8 @@ struct key *key_get_instantiation_authkey(key_serial_t target_id)
 
        if (IS_ERR(authkey_ref)) {
                authkey = ERR_CAST(authkey_ref);
+               if (authkey == ERR_PTR(-EAGAIN))
+                       authkey = ERR_PTR(-ENOKEY);
                goto error;
        }