public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: David Howells <dhowells@redhat.com>
Cc: steved@redhat.com, jmorris@namei.org,
	linux-security-module@vger.kernel.org, keyrings@linux-nfs.org,
	linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [Keyrings] [PATCH 7/9] KEYS: Permit in-place link replacement in keyring list
Date: Mon, 19 Mar 2012 10:44:32 -0400	[thread overview]
Message-ID: <20120319104432.56fe1e66@redhat.com> (raw)
In-Reply-To: <20120208110400.4050.11565.stgit@warthog.procyon.org.uk>

On Wed, 08 Feb 2012 11:04:00 +0000
David Howells <dhowells@redhat.com> 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@redhat.com>

  reply	other threads:[~2012-03-19 14:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-08 11:02 [PATCH 1/9] KEYS: Allow special keyrings to be cleared David Howells
2012-02-08 11:03 ` [PATCH 2/9] keys: update the description with info about "logon" keys David Howells
2012-02-08 11:03 ` [PATCH 3/9] KEYS: Move the key config into security/keys/Kconfig David Howells
2012-02-08 11:03 ` [PATCH 4/9] KEYS: Reorganise keys Makefile David Howells
2012-02-08 11:03 ` [PATCH 5/9] KEYS: Announce key type (un)registration David Howells
2012-02-08 11:03 ` [PATCH 6/9] KEYS: Perform RCU synchronisation on keys prior to key destruction David Howells
2012-03-19 14:31   ` [Keyrings] " Jeff Layton
2012-02-08 11:04 ` [PATCH 7/9] KEYS: Permit in-place link replacement in keyring list David Howells
2012-03-19 14:44   ` Jeff Layton [this message]
2012-03-19 15:39     ` [Keyrings] " David Howells
2012-02-08 11:04 ` [PATCH 8/9] KEYS: Do LRU discard in full keyrings David Howells
2012-02-08 11:04 ` [PATCH 9/9] KEYS: Add invalidation support David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120319104432.56fe1e66@redhat.com \
    --to=jlayton@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=jmorris@namei.org \
    --cc=keyrings@linux-nfs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=steved@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox