blk_crypto_find_keyslot() and blk_crypto_find_and_grab_keyslot() are called either with profile->lock held for reading or with that lock held for writing via blk_crypto_hw_enter(). Annotate both functions with __must_hold_shared(&profile->lock). blk_crypto_fallback_init() is only called with tfms_init_lock held. Annotate it with __must_hold(&tfms_init_lock). Signed-off-by: Bart Van Assche --- block/blk-crypto-fallback.c | 1 + block/blk-crypto-profile.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/block/blk-crypto-fallback.c b/block/blk-crypto-fallback.c index 12e0b487e23a..e06f64b0e9fb 100644 --- a/block/blk-crypto-fallback.c +++ b/block/blk-crypto-fallback.c @@ -535,6 +535,7 @@ int blk_crypto_fallback_evict_key(const struct blk_crypto_key *key) static bool blk_crypto_fallback_inited; static int blk_crypto_fallback_init(void) + __must_hold(&tfms_init_lock) { int i; int err; diff --git a/block/blk-crypto-profile.c b/block/blk-crypto-profile.c index 53126c091b0b..06e3e79a01c2 100644 --- a/block/blk-crypto-profile.c +++ b/block/blk-crypto-profile.c @@ -189,6 +189,7 @@ blk_crypto_remove_slot_from_lru_list(struct blk_crypto_keyslot *slot) static struct blk_crypto_keyslot * blk_crypto_find_keyslot(struct blk_crypto_profile *profile, const struct blk_crypto_key *key) + __must_hold_shared(&profile->lock) { const struct hlist_head *head = blk_crypto_hash_bucket_for_key(profile, key); @@ -204,6 +205,7 @@ blk_crypto_find_keyslot(struct blk_crypto_profile *profile, static struct blk_crypto_keyslot * blk_crypto_find_and_grab_keyslot(struct blk_crypto_profile *profile, const struct blk_crypto_key *key) + __must_hold_shared(&profile->lock) { struct blk_crypto_keyslot *slot;