diff options
| author | Greg Kroah-Hartman <[email protected]> | 2017-10-09 07:02:35 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2017-10-09 07:02:35 +0000 |
| commit | 1236d6bb6e19fc72ffc6bbcdeb1bfefe450e54ee (patch) | |
| tree | 47da3feee8e263e8c9352c85cf518e624be3c211 /security/keys/keyctl.c | |
| parent | staging: irda: au1k_ir.c fix warning: Prefer [subsystem eg: netdev]_info([sub... (diff) | |
| parent | Linux 4.14-rc4 (diff) | |
| download | kernel-1236d6bb6e19fc72ffc6bbcdeb1bfefe450e54ee.tar.gz kernel-1236d6bb6e19fc72ffc6bbcdeb1bfefe450e54ee.zip | |
Merge 4.14-rc4 into staging-next
We want the staging/iio fixes in here as well to handle merge issues.
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'security/keys/keyctl.c')
| -rw-r--r-- | security/keys/keyctl.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c index ab0b337c84b4..365ff85d7e27 100644 --- a/security/keys/keyctl.c +++ b/security/keys/keyctl.c @@ -766,12 +766,17 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen) key = key_ref_to_ptr(key_ref); + if (test_bit(KEY_FLAG_NEGATIVE, &key->flags)) { + ret = -ENOKEY; + goto error2; + } + /* see if we can read it directly */ ret = key_permission(key_ref, KEY_NEED_READ); if (ret == 0) goto can_read_key; if (ret != -EACCES) - goto error; + goto error2; /* we can't; see if it's searchable from this process's keyrings * - we automatically take account of the fact that it may be @@ -1406,11 +1411,9 @@ long keyctl_assume_authority(key_serial_t id) } ret = keyctl_change_reqkey_auth(authkey); - if (ret < 0) - goto error; + if (ret == 0) + ret = authkey->serial; key_put(authkey); - - ret = authkey->serial; error: return ret; } |
