On Sat, Nov 14, 2026 at 08:24:27PM +0000, [email protected] wrote:
> > + * The walk is RCU-protected, so the keyring's semaphore is not required.
> > A
> > + * keyring modified concurrently may list a key twice or miss one, but it
> > can
> > + * never have a link freed under the walk.
>
> Could the comment instead say that the caller holds the keyring's semaphore,
> which keeps the list and the link count stable across the walk and the
> length calculation, with RCU only keeping the walk itself memory-safe?
If I did not miss anything, this is the only remark.
Hmm...
I think this is enough prose to capture the preconditions:
/*
* The list and link count are stable across the walk as the caller
* holds keyring->sem.
*/
Br, Jarkko