From: Herbert Xu Date: Sun, 21 May 2006 01:57:20 +0000 (+1000) Subject: [CRYPTO] api: Allow replacement when registering new algorithms X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=996e2523cc347cc98237d2da3454aedc779fdcba;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [CRYPTO] api: Allow replacement when registering new algorithms We already allow asynchronous removal of existing algorithm modules. By allowing the replacement of existing algorithms, we can replace algorithms without having to wait for for all existing users to complete. Signed-off-by: Herbert Xu --- diff --git a/crypto/api.c b/crypto/api.c index 735fdedd8217..c11ec1fd4f18 100644 --- a/crypto/api.c +++ b/crypto/api.c @@ -267,13 +267,13 @@ int crypto_register_alg(struct crypto_alg *alg) down_write(&crypto_alg_sem); list_for_each_entry(q, &crypto_alg_list, cra_list) { - if (!strcmp(q->cra_driver_name, alg->cra_driver_name)) { + if (q == alg) { ret = -EEXIST; goto out; } } - list_add_tail(&alg->cra_list, &crypto_alg_list); + list_add(&alg->cra_list, &crypto_alg_list); out: up_write(&crypto_alg_sem); return ret;