crypto: ahash - Use GFP_KERNEL on allocation if the request can sleep
authorSteffen Klassert <steffen.klassert@secunet.com>
Fri, 24 Jul 2009 05:56:31 +0000 (13:56 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 24 Jul 2009 05:56:31 +0000 (13:56 +0800)
ahash_op_unaligned() and ahash_def_finup() allocate memory atomically,
regardless whether the request can sleep or not. This patch changes
this to use GFP_KERNEL if the request can sleep.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/ahash.c

index 28a33d06c274e89a619d4695e3697ead0484cb9d..33a4ff45f8425eb84c5a0308fcf80c50ddc40d9a 100644 (file)
@@ -223,7 +223,7 @@ static int ahash_op_unaligned(struct ahash_request *req,
 
        priv = kmalloc(sizeof(*priv) + ahash_align_buffer_size(ds, alignmask),
                       (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
-                      GFP_ATOMIC : GFP_ATOMIC);
+                      GFP_KERNEL : GFP_ATOMIC);
        if (!priv)
                return -ENOMEM;
 
@@ -333,7 +333,7 @@ static int ahash_def_finup(struct ahash_request *req)
 
        priv = kmalloc(sizeof(*priv) + ahash_align_buffer_size(ds, alignmask),
                       (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
-                      GFP_ATOMIC : GFP_ATOMIC);
+                      GFP_KERNEL : GFP_ATOMIC);
        if (!priv)
                return -ENOMEM;