Re: [Keyrings] [PATCH 7/9] KEYS: Permit in-place link replacement in keyring list

From: David Howells
Date: Mon Mar 19 2012 - 11:39:10 EST


Jeff Layton <jlayton@xxxxxxxxxx> wrote:

> Why is it safe to use key_put(rcu_access_pointer(...)) ? Clearly that
> pointer will end up being dereferenced, right?

Simple. This key_put() is called from within keyring_destroy() and that is
only ever called from the garbage collector - which is non-reentrant. Add to
that that key_put() never actually destroys a now-unused key, but merely
schedules the gc for a future run, and it's *that* that searches out unused
keys and deletes them.

David
--
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/