From: "Gonglei (Arei)" <arei.gonglei@huawei.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
Halil Pasic <pasic@linux.ibm.com>
Cc: Marc Hartmayer <mhartmay@linux.ibm.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"pizhenwei@bytedance.com" <pizhenwei@bytedance.com>
Subject: [PATCH] crypto: virtio-crypto: call finalize with bh disabled
Date: Mon, 25 Sep 2023 15:07:06 +0000 [thread overview]
Message-ID: <1914739e2de14ed396e5674aa2d4766c@huawei.com> (raw)
Doing ipsec produces a spinlock recursion warning.
This is due to not disabling BH during crypto completion function.
Fixes: 59ca6c93387d3 ("virtio-crypto: implement RSA algorithm")
Reported-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
drivers/crypto/virtio/virtio_crypto_akcipher_algs.c | 3 ++-
drivers/crypto/virtio/virtio_crypto_skcipher_algs.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c
index 2621ff8a9376..19e2898977d3 100644
--- a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c
+++ b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c
@@ -61,8 +61,9 @@ static void virtio_crypto_akcipher_finalize_req(
vc_akcipher_req->src_buf = NULL;
vc_akcipher_req->dst_buf = NULL;
virtcrypto_clear_request(&vc_akcipher_req->base);
-
+ local_bh_disable();
crypto_finalize_akcipher_request(vc_akcipher_req->base.dataq->engine, req, err);
+ local_bh_enable();
}
static void virtio_crypto_dataq_akcipher_callback(struct virtio_crypto_request *vc_req, int len)
diff --git a/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c b/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c
index 23c41d87d835..661c1102583e 100644
--- a/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c
+++ b/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c
@@ -566,9 +566,10 @@ static void virtio_crypto_skcipher_finalize_req(
AES_BLOCK_SIZE, 0);
kfree_sensitive(vc_sym_req->iv);
virtcrypto_clear_request(&vc_sym_req->base);
-
+ local_bh_disable();
crypto_finalize_skcipher_request(vc_sym_req->base.dataq->engine,
req, err);
+ local_bh_enable();
}
static struct virtio_crypto_algo virtio_crypto_algs[] = { {
--
2.23.0
next reply other threads:[~2023-09-25 15:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-25 15:07 Gonglei (Arei) [this message]
2023-09-26 16:41 ` [PATCH] crypto: virtio-crypto: call finalize with bh disabled Halil Pasic
2023-09-26 17:13 ` Michael S. Tsirkin
2023-09-27 9:24 ` Gonglei (Arei)
2023-09-27 13:25 ` Halil Pasic
2023-09-28 1:24 ` zhenwei pi
2023-09-28 2:03 ` Gonglei (Arei)
2023-09-27 9:36 ` Halil Pasic
2023-09-27 9:17 ` Gonglei (Arei)
2023-09-27 10:08 ` Cornelia Huck
2023-09-27 11:25 ` Halil Pasic
2023-09-27 12:12 ` Cornelia Huck
2023-09-27 13:11 ` Halil Pasic
2023-09-27 17:11 ` Halil Pasic
2023-11-02 13:01 ` Gonglei (Arei)
2023-11-06 10:08 ` Herbert Xu
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=1914739e2de14ed396e5674aa2d4766c@huawei.com \
--to=arei.gonglei@huawei.com \
--cc=herbert@gondor.apana.org.au \
--cc=jasowang@redhat.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhartmay@linux.ibm.com \
--cc=mst@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=pizhenwei@bytedance.com \
--cc=virtualization@lists.linux-foundation.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