From: Herbert Xu <herbert@gondor.apana.org.au>
To: liulongfang <liulongfang@huawei.com>
Cc: wangzhou1@hisilicon.com, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto/hisilicon: Add null judgment to the callback interface
Date: Thu, 10 Nov 2022 16:53:05 +0800 [thread overview]
Message-ID: <Y2y78USk4bXRrRun@gondor.apana.org.au> (raw)
In-Reply-To: <40a0e7aa-362a-0de7-76c0-77381c07f254@huawei.com>
On Thu, Nov 10, 2022 at 12:11:15PM +0800, liulongfang wrote:
>
> When using crypto's skcipher series interfaces for encryption and decryption
> services, User can use synchronous mode(by adjusting some skcipher interfaces,
> here is to remove skcipher_request_set_callback()) or asynchronous mode,
> but when using synchronous mode and the current asynchronous mode is loaded
> it will cause a calltrace.
>
> The current problem is that the interface of skcipher does not restrict users
> to call functions in this way for encryption services.
>
> If the current driver doesn't handle this, there is a possibility that some users
> deliberately create this kind of problem to cause the kernel to crash.
It sounds like your code is misusing the skcipher API. By default
skcipher is always async. You must always set a callback.
The only way to legally use skcipher without setting a callback
is by allocating it with crypto_alloc_sync_skcipher. In which case
unless your driver incorrectly declares itself as sync instead of
async, then it will never be used by such a user.
Cheers,
--
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
next prev parent reply other threads:[~2022-11-10 8:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-30 2:43 Longfang Liu
2022-09-30 2:49 ` Herbert Xu
2022-09-30 3:48 ` liulongfang
2022-10-28 3:57 ` Herbert Xu
2022-10-29 1:25 ` liulongfang
2022-11-04 9:08 ` Herbert Xu
2022-11-07 13:22 ` liulongfang
2022-11-08 9:59 ` Herbert Xu
2022-11-09 6:21 ` liulongfang
2022-11-09 9:18 ` Herbert Xu
2022-11-10 2:03 ` liulongfang
2022-11-10 3:20 ` Herbert Xu
2022-11-10 4:11 ` liulongfang
2022-11-10 8:53 ` Herbert Xu [this message]
2022-11-12 1:51 ` liulongfang
2022-10-28 2:26 ` liulongfang
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=Y2y78USk4bXRrRun@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liulongfang@huawei.com \
--cc=wangzhou1@hisilicon.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®