aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-06-11 12:30:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-06-27 10:02:34 -0400
commit4303ef19c6e6d16ea845c04b02b9cf086bcb8ed7 (patch)
tree83e649d3b9d3583c7576920a0feb08e38a19d1b5 /security/keys
parent7e27d6e778cd87b6f2415515d7127eba53fe5d02 (diff)
KEYS: Propagate error code instead of returning -EINVAL
This is from a Smatch check I'm writing. strncpy_from_user() returns -EFAULT on error so the first change just silences a warning but doesn't change how the code works. The other change is a bug fix because install_thread_keyring_to_cred() can return a variety of errors such as -EINVAL, -EEXIST, -ENOMEM or -EKEYREVOKED. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security/keys')
-rw-r--r--security/keys/keyctl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 13074b454743..6261745e4459 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -33,7 +33,7 @@ static int key_get_type_from_user(char *type,
33 ret = strncpy_from_user(type, _type, len); 33 ret = strncpy_from_user(type, _type, len);
34 34
35 if (ret < 0) 35 if (ret < 0)
36 return -EFAULT; 36 return ret;
37 37
38 if (ret == 0 || ret >= len) 38 if (ret == 0 || ret >= len)
39 return -EINVAL; 39 return -EINVAL;
@@ -1080,7 +1080,7 @@ set:
1080 return old_setting; 1080 return old_setting;
1081error: 1081error:
1082 abort_creds(new); 1082 abort_creds(new);
1083 return -EINVAL; 1083 return ret;
1084 1084
1085} /* end keyctl_set_reqkey_keyring() */ 1085} /* end keyctl_set_reqkey_keyring() */
1086 1086