mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-11-30 15:53:22 -05:00
security: Apply lockdep-based checking to rcu_dereference() uses
Apply lockdep-ified RCU primitives to key_gc_keyring() and keyring_destroy(). Cc: David Howells <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] LKML-Reference: <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
96be753af9
commit
e7b0a61b79
2 changed files with 5 additions and 2 deletions
|
|
@ -77,7 +77,8 @@ static bool key_gc_keyring(struct key *keyring, time_t limit)
|
|||
goto dont_gc;
|
||||
|
||||
/* scan the keyring looking for dead keys */
|
||||
klist = rcu_dereference(keyring->payload.subscriptions);
|
||||
klist = rcu_dereference_check(keyring->payload.subscriptions,
|
||||
lockdep_is_held(&key_serial_lock));
|
||||
if (!klist)
|
||||
goto dont_gc;
|
||||
|
||||
|
|
|
|||
|
|
@ -151,7 +151,9 @@ static void keyring_destroy(struct key *keyring)
|
|||
write_unlock(&keyring_name_lock);
|
||||
}
|
||||
|
||||
klist = rcu_dereference(keyring->payload.subscriptions);
|
||||
klist = rcu_dereference_check(keyring->payload.subscriptions,
|
||||
rcu_read_lock_held() ||
|
||||
atomic_read(&keyring->usage) == 0);
|
||||
if (klist) {
|
||||
for (loop = klist->nkeys - 1; loop >= 0; loop--)
|
||||
key_put(klist->keys[loop]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue