From: Herbert Xu <herbert@gondor.apana.org.au>
To: Muhammad Bilal <meatuni001@gmail.com>
Cc: thomas.lendacky@amd.com, john.allen@amd.com, davem@davemloft.net,
bp@alien8.de, ashish.kalra@amd.com, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org, meatuni001@gmail.com
Subject: Re: [PATCH] crypto: ccp - fix SFS ioctl race against device teardown
Date: Wed, 23 Sep 2026 18:57:59 +1000 [thread overview]
Message-ID: <arOUl7OArmq40doN@gondor.apana.org.au> (raw)
In-Reply-To: <20260919192432.272680-1-meatuni001@gmail.com>
Muhammad Bilal <meatuni001@gmail.com> wrote:
> sfs_ioctl() reads psp_master->sfs_data and caches it in sfs_dev before
> taking sfs_ioctl_mutex, while sfs_dev_destroy() frees sfs_dev->page
> and sfs_dev->command_buf with no locking at all and only clears
> psp->sfs_data afterwards. A call to sfs_ioctl() that reads sfs_data
> just before sfs_dev_destroy() runs will still acquire the mutex and
> go on to use the now-freed command buffer in send_sfs_cmd().
>
> Have both functions take sfs_ioctl_mutex before touching
> psp->sfs_data, so a call that is already using sfs_dev completes
> before teardown can free it, and a call arriving after teardown sees
> sfs_data cleared and returns -ENODEV instead of racing it.
>
> Fixes: 648dbccc03a0 ("crypto: ccp - Add AMD Seamless Firmware Servicing (SFS) driver")
> Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
> ---
> drivers/crypto/ccp/sfs.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
prev parent reply other threads:[~2026-09-23 8:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-19 19:24 Muhammad Bilal
2026-09-22 1:47 ` Kalra, Ashish
2026-09-23 8:26 ` Thomas Huth
2026-09-23 8:57 ` Herbert Xu [this message]
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=arOUl7OArmq40doN@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=ashish.kalra@amd.com \
--cc=bp@alien8.de \
--cc=davem@davemloft.net \
--cc=john.allen@amd.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=meatuni001@gmail.com \
--cc=thomas.lendacky@amd.com \
/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®