From: Jonathan Corbet Date: Tue, 1 Nov 2011 22:15:16 +0000 (+1100) Subject: crypto: user - Fix rwsem leak in crypto_user X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fb223c32b4d3ee593c8dce07e983680d06abe387;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git crypto: user - Fix rwsem leak in crypto_user The list_empty case in crypto_alg_match() will return without calling up_read() on crypto_alg_sem. We could do the "goto out" routine, but the function will clearly do the right thing with that test simply removed. Signed-off-by: Jonathan Corbet Signed-off-by: Herbert Xu --- diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c index 2abca780312d..0605a2bbba75 100644 --- a/crypto/crypto_user.c +++ b/crypto/crypto_user.c @@ -44,9 +44,6 @@ static struct crypto_alg *crypto_alg_match(struct crypto_user_alg *p, int exact) down_read(&crypto_alg_sem); - if (list_empty(&crypto_alg_list)) - return NULL; - list_for_each_entry(q, &crypto_alg_list, cra_list) { int match = 0;