diff options
author | Steffen Klassert <steffen.klassert@secunet.com> | 2010-07-07 15:30:10 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2010-07-14 20:29:28 +0800 |
commit | 2721251406e65f6415b802742dc7ab20482d2a18 (patch) | |
tree | 341a13813d82619f93c0bd8afd2fe3bcc065e801 | |
parent | a4dc0acba8785aef0539a237250af09a4d5fe65b (diff) | |
download | linux-crypto-2721251406e65f6415b802742dc7ab20482d2a18.tar.gz linux-crypto-2721251406e65f6415b802742dc7ab20482d2a18.zip |
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>
-rw-r--r-- | crypto/pcrypt.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c index 247178cb..71ae2b2a 100644 --- a/crypto/pcrypt.c +++ b/crypto/pcrypt.c @@ -385,6 +385,7 @@ static struct crypto_template pcrypt_tmpl = { static int __init pcrypt_init(void) { + int err = -ENOMEM; encwq = create_workqueue("pencrypt"); if (!encwq) goto err; @@ -400,14 +401,22 @@ static int __init pcrypt_init(void) pcrypt_dec_padata = padata_alloc(cpu_possible_mask, decwq); if (!pcrypt_dec_padata) - goto err_free_padata; + goto err_free_enc_padata; - padata_start(pcrypt_enc_padata); - padata_start(pcrypt_dec_padata); + err = padata_start(pcrypt_enc_padata); + if (err) + goto err_free_dec_padata; + + err = padata_start(pcrypt_dec_padata); + if (err) + goto err_free_dec_padata; return crypto_register_template(&pcrypt_tmpl); -err_free_padata: +err_free_dec_padata: + padata_free(pcrypt_dec_padata); + +err_free_enc_padata: padata_free(pcrypt_enc_padata); err_destroy_decwq: @@ -417,7 +426,7 @@ err_destroy_encwq: destroy_workqueue(encwq); err: - return -ENOMEM; + return err; } static void __exit pcrypt_exit(void) |