crypto: user - Fix rwsem leak in crypto_user
authorJonathan Corbet <[email protected]>
Tue, 1 Nov 2011 22:15:16 +0000 (09:15 +1100)
committerHerbert Xu <[email protected]>
Tue, 1 Nov 2011 22:15:16 +0000 (09:15 +1100)
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 <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
crypto/crypto_user.c

index 2abca780312d74246c60d7fcc9f6e9bf71f421c0..0605a2bbba75e17e67e59f602f1d12c453404031 100644 (file)
@@ -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;