diff options
Diffstat (limited to 'security/keys/keyring.c')
-rw-r--r-- | security/keys/keyring.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/security/keys/keyring.c b/security/keys/keyring.c index 8ec02746ca99..e814d2109f8e 100644 --- a/security/keys/keyring.c +++ b/security/keys/keyring.c | |||
@@ -151,7 +151,9 @@ static void keyring_destroy(struct key *keyring) | |||
151 | write_unlock(&keyring_name_lock); | 151 | write_unlock(&keyring_name_lock); |
152 | } | 152 | } |
153 | 153 | ||
154 | klist = rcu_dereference(keyring->payload.subscriptions); | 154 | klist = rcu_dereference_check(keyring->payload.subscriptions, |
155 | rcu_read_lock_held() || | ||
156 | atomic_read(&keyring->usage) == 0); | ||
155 | if (klist) { | 157 | if (klist) { |
156 | for (loop = klist->nkeys - 1; loop >= 0; loop--) | 158 | for (loop = klist->nkeys - 1; loop >= 0; loop--) |
157 | key_put(klist->keys[loop]); | 159 | key_put(klist->keys[loop]); |