From: Jarkko Sakkinen <jarkko@kernel.org>
To: keyrings@vger.kernel.org
Cc: stable@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org,
David Howells <dhowells@redhat.com>,
James Morris <jmorris@namei.org>,
Paul Moore <paul@paul-moore.com>,
"Serge E. Hallyn" <serge@hallyn.com>,
Guicai Ma <maguicai@kylinos.cn>
Subject: Re: [PATCH] KEYS: Prevent key type removal during key_instantiate_and_link()
Date: Tue, 24 Nov 2026 19:44:47 +0200 [thread overview]
Message-ID: <awXNDy90GGDeFPp8@kernel.org> (raw)
In-Reply-To: <20261124174035.1614480-1-jarkko@kernel.org>
On Tue, Nov 24, 2026 at 07:40:35PM +0200, Jarkko Sakkinen wrote:
> key_instantiate_and_link() accesses key->type outside key->sem, which can
> lead into null deref due that key types can be dropped at any possible
> time.
>
> Address this by moving key_construction_mutex inside key->sem, and match
> that order in key_reject_and_link())
>
> Cc: stable@vger.kernel.org
> Cc: keyrings@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-security-module@vger.kernel.org
> Cc: David Howells <dhowells@redhat.com>
> Cc: James Morris <jmorris@namei.org>
> Cc: Jarkko Sakkinen <jarkko@kernel.org>
> Cc: Paul Moore <paul@paul-moore.com>
> Cc: "Serge E. Hallyn" <serge@hallyn.com>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Reported-by: Guicai Ma <maguicai@kylinos.cn>
> Closes: https://lore.kernel.org/r/20261124091243.1019217-1-maguicai@kylinos.cn
> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Can be better addressed later with this:
https://lore.kernel.org/keyrings/20261112040242.247168-1-jarkko@kernel.org/
In erases all key type drop type of issue. Thus, totally acceptable
bug fix.
Br, Jarkko
next prev parent reply other threads:[~2026-11-24 17:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 17:40 [PATCH] KEYS: Prevent key type removal during key_instantiate_and_link() Jarkko Sakkinen
2026-11-24 17:44 ` Jarkko Sakkinen [this message]
2026-11-24 23:00 ` Guicai Ma
2026-11-24 23:24 ` Jarkko Sakkinen
2026-11-24 23:38 ` Jarkko Sakkinen
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=awXNDy90GGDeFPp8@kernel.org \
--to=jarkko@kernel.org \
--cc=dhowells@redhat.com \
--cc=jmorris@namei.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=maguicai@kylinos.cn \
--cc=paul@paul-moore.com \
--cc=serge@hallyn.com \
--cc=stable@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.