Re: [PATCH v2] crypto: ccp: Initialize DBC ioctl mutex before registering device
From: Herbert Xu
Date: Fri Sep 11 2026 - 01:37:51 EST
Runyu Xiao <runyu.xiao@xxxxxxxxxx> 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@xxxxxxxxxxxxxxx
> Link: https://lore.kernel.org/all/20260829133410.1708684-1-runyu.xiao@xxxxxxxxxx/
> Signed-off-by: Runyu Xiao <runyu.xiao@xxxxxxxxxx>
> Assisted-by: Codex:GPT-5
> ---
> v2:
> - Move mutex initialization before setting up the misc device, as suggested
> by Tom Lendacky.
>
> drivers/crypto/ccp/dbc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt