Преглед изворни кода

[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 <herbert@gondor.apana.org.au>
Herbert Xu пре 19 година
родитељ
комит
996e2523cc
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      crypto/api.c

+ 2 - 2
crypto/api.c

@@ -267,13 +267,13 @@ int crypto_register_alg(struct crypto_alg *alg)
 	down_write(&crypto_alg_sem);
 	down_write(&crypto_alg_sem);
 	
 	
 	list_for_each_entry(q, &crypto_alg_list, cra_list) {
 	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;
 			ret = -EEXIST;
 			goto out;
 			goto out;
 		}
 		}
 	}
 	}
 	
 	
-	list_add_tail(&alg->cra_list, &crypto_alg_list);
+	list_add(&alg->cra_list, &crypto_alg_list);
 out:	
 out:	
 	up_write(&crypto_alg_sem);
 	up_write(&crypto_alg_sem);
 	return ret;
 	return ret;