diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-10-27 10:31:44 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-10-27 10:31:44 +0200 |
commit | 6856b8e53609ee3eff7e3173e4e5d979f47d834d (patch) | |
tree | c2f9e364889fa07e20081b198a085a4ed7b26bd3 /security/keys/keyctl.c | |
parent | 57646b6fda9b751e62929c73b1e6df06b108a3c9 (diff) | |
parent | 2eece390bf68ec8f733d7e4a3ba8a5ea350082ae (diff) | |
download | linux-6856b8e53609ee3eff7e3173e4e5d979f47d834d.tar.bz2 |
Merge branch 'perf/urgent' into perf/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'security/keys/keyctl.c')
-rw-r--r-- | security/keys/keyctl.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c index 365ff85d7e27..76d22f726ae4 100644 --- a/security/keys/keyctl.c +++ b/security/keys/keyctl.c @@ -766,10 +766,9 @@ 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; - } + ret = key_read_state(key); + if (ret < 0) + goto error2; /* Negatively instantiated */ /* see if we can read it directly */ ret = key_permission(key_ref, KEY_NEED_READ); @@ -901,7 +900,7 @@ long keyctl_chown_key(key_serial_t id, uid_t user, gid_t group) atomic_dec(&key->user->nkeys); atomic_inc(&newowner->nkeys); - if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) { + if (key->state != KEY_IS_UNINSTANTIATED) { atomic_dec(&key->user->nikeys); atomic_inc(&newowner->nikeys); } |