aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/inode.c
diff options
context:
space:
mode:
authorRoberto Sassu <roberto.sassu@polito.it>2010-11-03 06:11:28 -0400
committerTyler Hicks <tyhicks@linux.vnet.ibm.com>2011-01-17 12:24:42 -0500
commit27992890b02d340198a3a22fc210d13684a41564 (patch)
tree7ece682994e705791c2c96a02cb139c1f42b0239 /fs/ecryptfs/inode.c
parent070baa51286e5cf59dde6be52fa23647ffb5d32d (diff)
ecryptfs: test lower_file pointer when lower_file_mutex is locked
This patch prevents the lower_file pointer in the 'ecryptfs_inode_info' structure to be checked when the mutex 'lower_file_mutex' is not locked. Signed-off-by: Roberto Sassu <roberto.sassu@polito.it> Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Diffstat (limited to 'fs/ecryptfs/inode.c')
-rw-r--r--fs/ecryptfs/inode.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 64ff02330752..bd33f87a1907 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -185,15 +185,13 @@ static int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry)
185 "context; rc = [%d]\n", rc); 185 "context; rc = [%d]\n", rc);
186 goto out; 186 goto out;
187 } 187 }
188 if (!ecryptfs_inode_to_private(ecryptfs_dentry->d_inode)->lower_file) { 188 rc = ecryptfs_init_persistent_file(ecryptfs_dentry);
189 rc = ecryptfs_init_persistent_file(ecryptfs_dentry); 189 if (rc) {
190 if (rc) { 190 printk(KERN_ERR "%s: Error attempting to initialize "
191 printk(KERN_ERR "%s: Error attempting to initialize " 191 "the persistent file for the dentry with name "
192 "the persistent file for the dentry with name " 192 "[%s]; rc = [%d]\n", __func__,
193 "[%s]; rc = [%d]\n", __func__, 193 ecryptfs_dentry->d_name.name, rc);
194 ecryptfs_dentry->d_name.name, rc); 194 goto out;
195 goto out;
196 }
197 } 195 }
198 rc = ecryptfs_write_metadata(ecryptfs_dentry); 196 rc = ecryptfs_write_metadata(ecryptfs_dentry);
199 if (rc) { 197 if (rc) {
@@ -302,15 +300,13 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry,
302 rc = -ENOMEM; 300 rc = -ENOMEM;
303 goto out; 301 goto out;
304 } 302 }
305 if (!ecryptfs_inode_to_private(ecryptfs_dentry->d_inode)->lower_file) { 303 rc = ecryptfs_init_persistent_file(ecryptfs_dentry);
306 rc = ecryptfs_init_persistent_file(ecryptfs_dentry); 304 if (rc) {
307 if (rc) { 305 printk(KERN_ERR "%s: Error attempting to initialize "
308 printk(KERN_ERR "%s: Error attempting to initialize " 306 "the persistent file for the dentry with name "
309 "the persistent file for the dentry with name " 307 "[%s]; rc = [%d]\n", __func__,
310 "[%s]; rc = [%d]\n", __func__, 308 ecryptfs_dentry->d_name.name, rc);
311 ecryptfs_dentry->d_name.name, rc); 309 goto out_free_kmem;
312 goto out_free_kmem;
313 }
314 } 310 }
315 crypt_stat = &ecryptfs_inode_to_private( 311 crypt_stat = &ecryptfs_inode_to_private(
316 ecryptfs_dentry->d_inode)->crypt_stat; 312 ecryptfs_dentry->d_inode)->crypt_stat;