Message ID | 20170927195047.122358-4-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..551f099f2f6a 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 & (1 << KEY_FLAG_INSTANTIATED)) && + !(flags & (1 << KEY_FLAG_NEGATIVE)); } #define dereference_key_rcu(KEY) \