aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorSteffen Klassert <steffen.klassert@secunet.com>2010-07-07 09:30:10 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2010-07-14 08:29:28 -0400
commit4c879170296174bde05cd1c643dac16594edee77 (patch)
tree467afaa9ad1235caa110789621edb7726fdcb4cd /crypto
parent7e3de7b1be6ce0643f60aed697070e2286db32cd (diff)
padata: Check for valid padata instance on start
This patch introduces the PADATA_INVALID flag which is checked on padata start. This will be used to mark a padata instance as invalid, if the padata cpumask does not intersect with the active cpumask. we change padata_start to return an error if the PADATA_INVALID is set. Also we adapt the only padata user, pcrypt to this change. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/pcrypt.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
index 247178cb98ec..71ae2b2ae33b 100644
--- a/crypto/pcrypt.c
+++ b/crypto/pcrypt.c
@@ -385,6 +385,7 @@ static struct crypto_template pcrypt_tmpl = {
385 385
386static int __init pcrypt_init(void) 386static int __init pcrypt_init(void)
387{ 387{
388 int err = -ENOMEM;
388 encwq = create_workqueue("pencrypt"); 389 encwq = create_workqueue("pencrypt");
389 if (!encwq) 390 if (!encwq)
390 goto err; 391 goto err;
@@ -400,14 +401,22 @@ static int __init pcrypt_init(void)
400 401
401 pcrypt_dec_padata = padata_alloc(cpu_possible_mask, decwq); 402 pcrypt_dec_padata = padata_alloc(cpu_possible_mask, decwq);
402 if (!pcrypt_dec_padata) 403 if (!pcrypt_dec_padata)
403 goto err_free_padata; 404 goto err_free_enc_padata;
404 405
405 padata_start(pcrypt_enc_padata); 406 err = padata_start(pcrypt_enc_padata);
406 padata_start(pcrypt_dec_padata); 407 if (err)
408 goto err_free_dec_padata;
409
410 err = padata_start(pcrypt_dec_padata);
411 if (err)
412 goto err_free_dec_padata;
407 413
408 return crypto_register_template(&pcrypt_tmpl); 414 return crypto_register_template(&pcrypt_tmpl);
409 415
410err_free_padata: 416err_free_dec_padata:
417 padata_free(pcrypt_dec_padata);
418
419err_free_enc_padata:
411 padata_free(pcrypt_enc_padata); 420 padata_free(pcrypt_enc_padata);
412 421
413err_destroy_decwq: 422err_destroy_decwq:
@@ -417,7 +426,7 @@ err_destroy_encwq:
417 destroy_workqueue(encwq); 426 destroy_workqueue(encwq);
418 427
419err: 428err:
420 return -ENOMEM; 429 return err;
421} 430}
422 431
423static void __exit pcrypt_exit(void) 432static void __exit pcrypt_exit(void)