From: Rui Wang <rui.y.wang@intel.com>
To: herbert@gondor.apana.org.au
Cc: tim.c.chen@linux.intel.com, rui.y.wang@intel.com,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/4] crypto: algif_hash - wait for crypto_ahash_init() to complete
Date: Wed, 27 Jan 2016 17:08:37 +0800 [thread overview]
Message-ID: <1453885718-24599-4-git-send-email-rui.y.wang@intel.com> (raw)
In-Reply-To: <1453885718-24599-1-git-send-email-rui.y.wang@intel.com>
hash_sendmsg/sendpage() need to wait for the completion
of crypto_ahash_init() otherwise it can cause panic.
Signed-off-by: Rui Wang <rui.y.wang@intel.com>
---
crypto/algif_hash.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
index b4c24fe..83dc095 100644
--- a/crypto/algif_hash.c
+++ b/crypto/algif_hash.c
@@ -49,7 +49,8 @@ static int hash_sendmsg(struct socket *sock, struct msghdr *msg,
lock_sock(sk);
if (!ctx->more) {
- err = crypto_ahash_init(&ctx->req);
+ err = af_alg_wait_for_completion(crypto_ahash_init(&ctx->req),
+ &ctx->completion);
if (err)
goto unlock;
}
@@ -120,6 +121,7 @@ static ssize_t hash_sendpage(struct socket *sock, struct page *page,
} else {
if (!ctx->more) {
err = crypto_ahash_init(&ctx->req);
+ err = af_alg_wait_for_completion(err, &ctx->completion);
if (err)
goto unlock;
}
--
1.8.3.1
next prev parent reply other threads:[~2016-01-27 9:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-27 9:08 [PATCH v2 0/4] Fix sha1_mb failure and testing import()/export() Rui Wang
2016-01-27 9:08 ` [PATCH v2 1/4] crypto x86/sha1_mb: Fix load failure Rui Wang
2016-02-01 8:17 ` Herbert Xu
2016-01-27 9:08 ` [PATCH v2 2/4] crypto: mcryptd - " Rui Wang
2016-02-01 8:16 ` Herbert Xu
2016-01-27 9:08 ` Rui Wang [this message]
2016-02-01 8:17 ` [PATCH v2 3/4] crypto: algif_hash - wait for crypto_ahash_init() to complete Herbert Xu
2016-01-27 9:08 ` [PATCH v2 4/4] crypto: testmgr - Add a test case for import()/export() Rui Wang
2016-02-01 8:21 ` 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=1453885718-24599-4-git-send-email-rui.y.wang@intel.com \
--to=rui.y.wang@intel.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tim.c.chen@linux.intel.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®