aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ecryptfs/crypto.c8
-rw-r--r--fs/ecryptfs/keystore.c11
2 files changed, 9 insertions, 10 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 4610fd6afcef..520783b205a1 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -923,7 +923,9 @@ static int ecryptfs_copy_mount_wide_sigs_to_inode_sigs(
923 struct ecryptfs_global_auth_tok *global_auth_tok; 923 struct ecryptfs_global_auth_tok *global_auth_tok;
924 int rc = 0; 924 int rc = 0;
925 925
926 mutex_lock(&crypt_stat->keysig_list_mutex);
926 mutex_lock(&mount_crypt_stat->global_auth_tok_list_mutex); 927 mutex_lock(&mount_crypt_stat->global_auth_tok_list_mutex);
928
927 list_for_each_entry(global_auth_tok, 929 list_for_each_entry(global_auth_tok,
928 &mount_crypt_stat->global_auth_tok_list, 930 &mount_crypt_stat->global_auth_tok_list,
929 mount_crypt_stat_list) { 931 mount_crypt_stat_list) {
@@ -932,13 +934,13 @@ static int ecryptfs_copy_mount_wide_sigs_to_inode_sigs(
932 rc = ecryptfs_add_keysig(crypt_stat, global_auth_tok->sig); 934 rc = ecryptfs_add_keysig(crypt_stat, global_auth_tok->sig);
933 if (rc) { 935 if (rc) {
934 printk(KERN_ERR "Error adding keysig; rc = [%d]\n", rc); 936 printk(KERN_ERR "Error adding keysig; rc = [%d]\n", rc);
935 mutex_unlock(
936 &mount_crypt_stat->global_auth_tok_list_mutex);
937 goto out; 937 goto out;
938 } 938 }
939 } 939 }
940 mutex_unlock(&mount_crypt_stat->global_auth_tok_list_mutex); 940
941out: 941out:
942 mutex_unlock(&mount_crypt_stat->global_auth_tok_list_mutex);
943 mutex_unlock(&crypt_stat->keysig_list_mutex);
942 return rc; 944 return rc;
943} 945}
944 946
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index 259525c9abb8..f9965139c430 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -2366,21 +2366,18 @@ struct kmem_cache *ecryptfs_key_sig_cache;
2366int ecryptfs_add_keysig(struct ecryptfs_crypt_stat *crypt_stat, char *sig) 2366int ecryptfs_add_keysig(struct ecryptfs_crypt_stat *crypt_stat, char *sig)
2367{ 2367{
2368 struct ecryptfs_key_sig *new_key_sig; 2368 struct ecryptfs_key_sig *new_key_sig;
2369 int rc = 0;
2370 2369
2371 new_key_sig = kmem_cache_alloc(ecryptfs_key_sig_cache, GFP_KERNEL); 2370 new_key_sig = kmem_cache_alloc(ecryptfs_key_sig_cache, GFP_KERNEL);
2372 if (!new_key_sig) { 2371 if (!new_key_sig) {
2373 rc = -ENOMEM;
2374 printk(KERN_ERR 2372 printk(KERN_ERR
2375 "Error allocating from ecryptfs_key_sig_cache\n"); 2373 "Error allocating from ecryptfs_key_sig_cache\n");
2376 goto out; 2374 return -ENOMEM;
2377 } 2375 }
2378 memcpy(new_key_sig->keysig, sig, ECRYPTFS_SIG_SIZE_HEX); 2376 memcpy(new_key_sig->keysig, sig, ECRYPTFS_SIG_SIZE_HEX);
2379 mutex_lock(&crypt_stat->keysig_list_mutex); 2377 /* Caller must hold keysig_list_mutex */
2380 list_add(&new_key_sig->crypt_stat_list, &crypt_stat->keysig_list); 2378 list_add(&new_key_sig->crypt_stat_list, &crypt_stat->keysig_list);
2381 mutex_unlock(&crypt_stat->keysig_list_mutex); 2379
2382out: 2380 return 0;
2383 return rc;
2384} 2381}
2385 2382
2386struct kmem_cache *ecryptfs_global_auth_tok_cache; 2383struct kmem_cache *ecryptfs_global_auth_tok_cache;