summaryrefslogtreecommitdiffstats
path: root/security/keys/gc.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2012-05-11 11:56:56 +0200
committerDavid Howells <dhowells@redhat.com>2012-05-11 11:56:56 +0200
commit233e4735f2a45d9e641c2488b8d7afeb1f377dac (patch)
treed273536aaea91cf4817dd305450f327ebb37059f /security/keys/gc.c
parentKEYS: Perform RCU synchronisation on keys prior to key destruction (diff)
downloadlinux-233e4735f2a45d9e641c2488b8d7afeb1f377dac.tar.xz
linux-233e4735f2a45d9e641c2488b8d7afeb1f377dac.zip
KEYS: Permit in-place link replacement in keyring list
Make use of the previous patch that makes the garbage collector perform RCU synchronisation before destroying defunct keys. Key pointers can now be replaced in-place without creating a new keyring payload and replacing the whole thing as the discarded keys will not be destroyed until all currently held RCU read locks are released. If the keyring payload space needs to be expanded or contracted, then a replacement will still need allocating, and the original will still have to be freed by RCU. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'security/keys/gc.c')
-rw-r--r--security/keys/gc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/keys/gc.c b/security/keys/gc.c
index 27610bf72195..adddaa258d50 100644
--- a/security/keys/gc.c
+++ b/security/keys/gc.c
@@ -148,7 +148,7 @@ static void key_gc_keyring(struct key *keyring, time_t limit)
loop = klist->nkeys;
smp_rmb();
for (loop--; loop >= 0; loop--) {
- key = klist->keys[loop];
+ key = rcu_dereference(klist->keys[loop]);
if (test_bit(KEY_FLAG_DEAD, &key->flags) ||
(key->expiry > 0 && key->expiry <= limit))
goto do_gc;