Message ID | 20170926201105.126166-3-ebiggers3@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/include/linux/key.h b/include/linux/key.h index b7b590d7c480..fcb79eedbdb5 100644 --- a/include/linux/key.h +++ b/include/linux/key.h @@ -372,8 +372,11 @@ extern void key_set_timeout(struct key *, unsigned); */ static inline bool key_is_instantiated(const struct key *key) { - return test_bit(KEY_FLAG_INSTANTIATED, &key->flags) && - !test_bit(KEY_FLAG_NEGATIVE, &key->flags); + /* Pairs with RELEASE in mark_key_instantiated() */ + unsigned long flags = smp_load_acquire(&key->flags); + + return (flags & KEY_FLAG_INSTANTIATED) && + !(flags & KEY_FLAG_NEGATIVE); } #define dereference_key_rcu(KEY) \