[Devel] [PATCH RHEL7 COMMIT] ms/crypto: algif_hash - wait for crypto_ahash_init() to complete

Konstantin Khorenko khorenko at virtuozzo.com
Mon Oct 24 05:34:06 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.36.1.vz7.19.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.36.1.vz7.19.3
------>
commit ab2a5a5d05b3eb3af8a22e69e0dde97590956154
Author: Wang, Rui Y <rui.y.wang at intel.com>
Date:   Mon Oct 24 16:34:06 2016 +0400

    ms/crypto: algif_hash - wait for crypto_ahash_init() to complete
    
    hash_sendmsg/sendpage() need to wait for the completion
    of crypto_ahash_init() otherwise it can cause panic.
    
    Cc: stable at vger.kernel.org
    Signed-off-by: Rui Wang <rui.y.wang at intel.com>
    Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
    (cherry picked from commit fe09786178f9df713a4b2dd6b93c0a722346bf5e)
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.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 7a70b07..7bc3f89 100644
--- a/crypto/algif_hash.c
+++ b/crypto/algif_hash.c
@@ -56,7 +56,8 @@ static int hash_sendmsg(struct kiocb *unused, struct socket *sock,
 
 	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;
 	}
@@ -136,6 +137,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;
 		}


More information about the Devel mailing list