diff options
author | Eric Sandeen <sandeen@redhat.com> | 2007-12-22 17:03:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-12-23 15:54:37 -0500 |
commit | c8161f64ccdcc3ac05c7bbfebc031e7ad5ca6412 (patch) | |
tree | 24adc1225b4f56b28533efe59ee357fe912403c5 | |
parent | c525460e2754dbb33abe2b37d3d941126b2ea830 (diff) |
ecryptfs: fix unlocking in error paths
Thanks to Josef Bacik for finding these.
A couple of ecryptfs error paths don't properly unlock things they locked.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Cc: Josef Bacik <jbacik@redhat.com>
Cc: Michael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/ecryptfs/crypto.c | 8 | ||||
-rw-r--r-- | fs/ecryptfs/messaging.c | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index 67e8b16f7bcb..f8ef0af919e7 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
@@ -799,7 +799,7 @@ int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat) | |||
799 | rc = ecryptfs_crypto_api_algify_cipher_name(&full_alg_name, | 799 | rc = ecryptfs_crypto_api_algify_cipher_name(&full_alg_name, |
800 | crypt_stat->cipher, "cbc"); | 800 | crypt_stat->cipher, "cbc"); |
801 | if (rc) | 801 | if (rc) |
802 | goto out; | 802 | goto out_unlock; |
803 | crypt_stat->tfm = crypto_alloc_blkcipher(full_alg_name, 0, | 803 | crypt_stat->tfm = crypto_alloc_blkcipher(full_alg_name, 0, |
804 | CRYPTO_ALG_ASYNC); | 804 | CRYPTO_ALG_ASYNC); |
805 | kfree(full_alg_name); | 805 | kfree(full_alg_name); |
@@ -808,12 +808,12 @@ int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat) | |||
808 | ecryptfs_printk(KERN_ERR, "cryptfs: init_crypt_ctx(): " | 808 | ecryptfs_printk(KERN_ERR, "cryptfs: init_crypt_ctx(): " |
809 | "Error initializing cipher [%s]\n", | 809 | "Error initializing cipher [%s]\n", |
810 | crypt_stat->cipher); | 810 | crypt_stat->cipher); |
811 | mutex_unlock(&crypt_stat->cs_tfm_mutex); | 811 | goto out_unlock; |
812 | goto out; | ||
813 | } | 812 | } |
814 | crypto_blkcipher_set_flags(crypt_stat->tfm, CRYPTO_TFM_REQ_WEAK_KEY); | 813 | crypto_blkcipher_set_flags(crypt_stat->tfm, CRYPTO_TFM_REQ_WEAK_KEY); |
815 | mutex_unlock(&crypt_stat->cs_tfm_mutex); | ||
816 | rc = 0; | 814 | rc = 0; |
815 | out_unlock: | ||
816 | mutex_unlock(&crypt_stat->cs_tfm_mutex); | ||
817 | out: | 817 | out: |
818 | return rc; | 818 | return rc; |
819 | } | 819 | } |
diff --git a/fs/ecryptfs/messaging.c b/fs/ecryptfs/messaging.c index a96d341d154d..9cc2aec27b0d 100644 --- a/fs/ecryptfs/messaging.c +++ b/fs/ecryptfs/messaging.c | |||
@@ -427,6 +427,7 @@ int ecryptfs_init_messaging(unsigned int transport) | |||
427 | if (!ecryptfs_daemon_id_hash) { | 427 | if (!ecryptfs_daemon_id_hash) { |
428 | rc = -ENOMEM; | 428 | rc = -ENOMEM; |
429 | ecryptfs_printk(KERN_ERR, "Failed to allocate memory\n"); | 429 | ecryptfs_printk(KERN_ERR, "Failed to allocate memory\n"); |
430 | mutex_unlock(&ecryptfs_daemon_id_hash_mux); | ||
430 | goto out; | 431 | goto out; |
431 | } | 432 | } |
432 | for (i = 0; i < ecryptfs_hash_buckets; i++) | 433 | for (i = 0; i < ecryptfs_hash_buckets; i++) |