Re: [Keyrings] [PATCH 7/9] KEYS: Permit in-place link replacementin keyring list
From: Jeff Layton
Date: Mon Mar 19 2012 - 10:44:13 EST
On Wed, 08 Feb 2012 11:04:00 +0000
David Howells <dhowells@xxxxxxxxxx> wrote:
> @@ -154,11 +164,10 @@ static void keyring_destroy(struct key *keyring)
> write_unlock(&keyring_name_lock);
> }
>
> - klist = rcu_dereference_check(keyring->payload.subscriptions,
> - atomic_read(&keyring->usage) == 0);
> + klist = rcu_access_pointer(keyring->payload.subscriptions);
> if (klist) {
> for (loop = klist->nkeys - 1; loop >= 0; loop--)
> - key_put(klist->keys[loop]);
> + key_put(rcu_access_pointer(klist->keys[loop]));
> kfree(klist);
> }
> }
Why is it safe to use key_put(rcu_access_pointer(...)) ? Clearly that
pointer will end up being dereferenced, right?
--
Jeff Layton <jlayton@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/