Re: [PATCH v2] keys: serialise key instantiation against keyctl_chown_key()

From: Jarkko Sakkinen

Date: Tue Nov 17 2026 - 11:23:13 EST


On Tue, Nov 17, 2026 at 06:21:43PM +0200, Jarkko Sakkinen wrote:
> On Tue, Nov 17, 2026 at 12:34:12PM +0000, Sinan Turunc wrote:
> > Subclass 2 is an unused lockdep subclass that is
> > only ever taken inside key_construction_mutex. Subclasses 0 and 1 are
> > already taken outside keyring_serialise_link_lock by __key_link_lock() and
> > __key_move_lock().
>
> Delete also this as there was no bug associated with nesting levels.
>
> And this does not need additional fixes despite I forewarned about that.
>
> I'll wait for v3.

"Take key->sem for write with down_write_nested(&key->sem, 2) inside
key_construction_mutex in __key_instantiate_and_link() and
key_reject_and_link()."

This sentence tells everything about nesting that this patch requires.

Br, Jarkko