Commit 5befbd5a authored by Steffen Klassert's avatar Steffen Klassert Committed by Herbert Xu

crypto: ahash - Use GFP_KERNEL on allocation if the request can sleep

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: default avatarSteffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent f592682f
...@@ -223,7 +223,7 @@ static int ahash_op_unaligned(struct ahash_request *req, ...@@ -223,7 +223,7 @@ static int ahash_op_unaligned(struct ahash_request *req,
priv = kmalloc(sizeof(*priv) + ahash_align_buffer_size(ds, alignmask), priv = kmalloc(sizeof(*priv) + ahash_align_buffer_size(ds, alignmask),
(req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ? (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
GFP_ATOMIC : GFP_ATOMIC); GFP_KERNEL : GFP_ATOMIC);
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
...@@ -333,7 +333,7 @@ static int ahash_def_finup(struct ahash_request *req) ...@@ -333,7 +333,7 @@ static int ahash_def_finup(struct ahash_request *req)
priv = kmalloc(sizeof(*priv) + ahash_align_buffer_size(ds, alignmask), priv = kmalloc(sizeof(*priv) + ahash_align_buffer_size(ds, alignmask),
(req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ? (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
GFP_ATOMIC : GFP_ATOMIC); GFP_KERNEL : GFP_ATOMIC);
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment