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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux