diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-06-20 12:28:21 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-06-20 12:28:21 +0200 |
commit | 902b31941327a0e9c0ca9eb7750414ae41bf8a89 (patch) | |
tree | 300f4226c87e6df403cda861ab6766b23d278f09 /security/keys/key.c | |
parent | c5ae366e12b2bd56fc7d7e9d484836bec9ddc110 (diff) | |
parent | 2055da97389a605c8a00d163d40903afbe413921 (diff) |
Merge branch 'WIP.sched/core' into sched/core
Conflicts:
kernel/sched/Makefile
Pick up the waitqueue related renames - it didn't get much feedback,
so it appears to be uncontroversial. Famous last words? ;-)
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'security/keys/key.c')
-rw-r--r-- | security/keys/key.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/security/keys/key.c b/security/keys/key.c index 455c04d80bbb..83da68d98b40 100644 --- a/security/keys/key.c +++ b/security/keys/key.c @@ -660,14 +660,11 @@ not_found: goto error; found: - /* pretend it doesn't exist if it is awaiting deletion */ - if (refcount_read(&key->usage) == 0) - goto not_found; - - /* this races with key_put(), but that doesn't matter since key_put() - * doesn't actually change the key + /* A key is allowed to be looked up only if someone still owns a + * reference to it - otherwise it's awaiting the gc. */ - __key_get(key); + if (!refcount_inc_not_zero(&key->usage)) + goto not_found; error: spin_unlock(&key_serial_lock); @@ -966,12 +963,11 @@ int key_update(key_ref_t key_ref, const void *payload, size_t plen) /* the key must be writable */ ret = key_permission(key_ref, KEY_NEED_WRITE); if (ret < 0) - goto error; + return ret; /* attempt to update it if supported */ - ret = -EOPNOTSUPP; if (!key->type->update) - goto error; + return -EOPNOTSUPP; memset(&prep, 0, sizeof(prep)); prep.data = payload; |