[PATCH v3] KEYS: Protect key instantiation and rejection against type removal

Jarkko Sakkinen jarkko at kernel.org
Wed Nov 25 22:45:18 UTC 2026


On Wed, Nov 25, 2026 at 03:48:12AM +0000, sashiko-bot at kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Medium] KEYS: key_reject_and_link() locks key->sem with freed modular
>   lockdep class
> --
> 
> commit c70f356b6ccdc592f27c6c5e32e3b0a02a265eb1
> Author: Guicai Ma <maguicai at kylinos.cn>
> 
> KEYS: Protect key instantiation and rejection against type removal
> 
> This commit guards key_instantiate_and_link() and key_reject_and_link()
> with key_type_srcu and a KEY_FLAG_DEAD check, and waits with
> synchronize_srcu(&key_type_srcu) after pass 1 of key_garbage_collector()
> marks dead keys.


Please rebase v4 onto linux-next, or my master.

When 'dead' is true in key_reject_and_link() under
key_construction_mutex alone, clear KEY_FLAG_USER_CONSTRUCT (and wake
waiters), and invalidate authkey while leaving key->state as
KEY_IS_UNINSTANTIATED.

wait_for_key_construction() will then return -EKEYREVOKED via
key_validate().

Br, Jarkko



More information about the Linux-security-module-archive mailing list