Skip to contentSkip to conversation

crypto: Fix rwsem leak in crypto_user

PATCH In review Jonathan Corbet 2 participants 2 messages Nov 1, 2011 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: 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.

crypto/crypto_user.c +0 -3
index 2abca78..0605a2b 100644
@@ -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;
 
#1 lore raw
Quoted 5 lines · Jonathan Corbet

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.

Patch applied. Thanks a lot Jon!

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt