KEYS: __key_link() should use the RCU deref wrapper for keyring payloads
authorDavid Howells <dhowells@redhat.com>
Mon, 22 Aug 2011 13:08:51 +0000 (14:08 +0100)
committerJames Morris <jmorris@namei.org>
Mon, 22 Aug 2011 23:57:34 +0000 (09:57 +1000)
__key_link() should use the RCU deref wrapper rcu_dereference_locked_keyring()
for accessing keyring payloads rather than calling rcu_dereference_protected()
directly.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
security/keys/keyring.c

index 30e242f7bd0ec413bca908f1a0fdc5398b00a124..37a7f3b28852e098f57ab1cd98eb2eccdad5c7c5 100644 (file)
@@ -860,8 +860,7 @@ void __key_link(struct key *keyring, struct key *key,
 
        kenter("%d,%d,%p", keyring->serial, key->serial, nklist);
 
-       klist = rcu_dereference_protected(keyring->payload.subscriptions,
-                                         rwsem_is_locked(&keyring->sem));
+       klist = rcu_dereference_locked_keyring(keyring);
 
        atomic_inc(&key->usage);