From: Tom Lendacky <thomas.lendacky@amd.com>
To: Runyu Xiao <runyu.xiao@seu.edu.cn>, mario.limonciello@amd.com
Cc: jianhao.xu@seu.edu.cn, john.allen@amd.com,
herbert@gondor.apana.org.au, davem@davemloft.net,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] crypto: ccp: Initialize DBC ioctl mutex before registering device
Date: Sat, 29 Aug 2026 10:07:55 -0500 [thread overview]
Message-ID: <8a00da60-ccdc-4579-804e-0c7d7c12ebe1@amd.com> (raw)
In-Reply-To: <20260829133410.1708684-1-runyu.xiao@seu.edu.cn>
On 8/29/26 08:34, Runyu Xiao wrote:
> dbc_dev_init() registers the DBC misc device before initializing
> ioctl_mutex. Once misc_register() publishes the device, userspace can
> open it and invoke dbc_ioctl() while the mutex is still uninitialized.
>
> Initialize ioctl_mutex before calling misc_register() so the published
> ioctl callback always sees an initialized mutex.
>
> Fixes: c04cf9e14f10 ("crypto: ccp - Add support for fetching a nonce for dynamic boost control")
> Cc: stable@vger.kernel.org
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
> Assisted-by: Codex:GPT-5
> ---
> drivers/crypto/ccp/dbc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/crypto/ccp/dbc.c b/drivers/crypto/ccp/dbc.c
> index 410084a90..00c864413 100644
> --- a/drivers/crypto/ccp/dbc.c
> +++ b/drivers/crypto/ccp/dbc.c
> @@ -240,12 +240,12 @@ int dbc_dev_init(struct psp_device *psp)
> dbc_dev->char_dev.name = "dbc";
> dbc_dev->char_dev.fops = &dbc_fops;
> dbc_dev->char_dev.mode = 0600;
> + mutex_init(&dbc_dev->ioctl_mutex);
This mixes it in with the misc_register() settings and the call, move it
to just before all the settings.
Thanks,
Tom
> +
> ret = misc_register(&dbc_dev->char_dev);
> if (ret)
> goto cleanup_mbox;
>
> - mutex_init(&dbc_dev->ioctl_mutex);
> -
> return 0;
>
> cleanup_mbox:
next prev parent reply other threads:[~2026-08-29 15:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-29 13:34 Runyu Xiao
2026-08-29 15:07 ` Tom Lendacky [this message]
2026-08-30 1:51 ` [PATCH v2] " Runyu Xiao
2026-08-30 15:19 ` Tom Lendacky
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=8a00da60-ccdc-4579-804e-0c7d7c12ebe1@amd.com \
--to=thomas.lendacky@amd.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=jianhao.xu@seu.edu.cn \
--cc=john.allen@amd.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=runyu.xiao@seu.edu.cn \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®