KEYS: Propagate error code instead of returning -EINVAL
[sfrench/cifs-2.6.git] / security / keys / keyctl.c
index 8f4dce1987c492c59a9e2a6870b1bebaeaac09a8..6261745e44591acd65bb47e18e9f65b9e842bfe5 100644 (file)
@@ -33,7 +33,7 @@ static int key_get_type_from_user(char *type,
        ret = strncpy_from_user(type, _type, len);
 
        if (ret < 0)
-               return -EFAULT;
+               return ret;
 
        if (ret == 0 || ret >= len)
                return -EINVAL;
@@ -1080,7 +1080,7 @@ set:
        return old_setting;
 error:
        abort_creds(new);
-       return -EINVAL;
+       return ret;
 
 } /* end keyctl_set_reqkey_keyring() */
 
@@ -1269,7 +1269,7 @@ long keyctl_session_to_parent(void)
                goto not_permitted;
 
        /* the parent must be single threaded */
-       if (atomic_read(&parent->signal->count) != 1)
+       if (!thread_group_empty(parent))
                goto not_permitted;
 
        /* the parent and the child must have different session keyrings or