aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Rosenberg <drosen@google.com>2018-07-20 16:11:40 -0700
committerAmit Pundir <amit.pundir@linaro.org>2018-10-04 14:34:36 +0530
commit8fd9c723bde83907697121ca0f7beb51bbdb32da (patch)
tree9fd116e304dd82d6ff6c734d1cb1743fed8a4fd2
parent18c7d13c75ce870858134ddfb8a823bd6a057489 (diff)
downloadlinux-linaro-stable-linux-linaro-lsk-v4.4-android.tar.gz
ANDROID: sdcardfs: Change current->fs under locklinux-linaro-lsk-v4.4-android
bug: 111641492 Change-Id: I79e9894f94880048edaf0f7cfa2d180f65cbcf3b Reported-by: Jann Horn <jannh@google.com> Signed-off-by: Daniel Rosenberg <drosen@google.com> Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
-rw-r--r--fs/sdcardfs/inode.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/sdcardfs/inode.c b/fs/sdcardfs/inode.c
index 0b9c345cd01c..6c0039284ae0 100644
--- a/fs/sdcardfs/inode.c
+++ b/fs/sdcardfs/inode.c
@@ -96,8 +96,11 @@ static int sdcardfs_create(struct inode *dir, struct dentry *dentry,
err = -ENOMEM;
goto out_unlock;
}
+ copied_fs->umask = 0;
+ task_lock(current);
current->fs = copied_fs;
- current->fs->umask = 0;
+ task_unlock(current);
+
err = vfs_create2(lower_dentry_mnt, d_inode(lower_parent_dentry), lower_dentry, mode, want_excl);
if (err)
goto out;
@@ -111,7 +114,9 @@ static int sdcardfs_create(struct inode *dir, struct dentry *dentry,
fixup_lower_ownership(dentry, dentry->d_name.name);
out:
+ task_lock(current);
current->fs = saved_fs;
+ task_unlock(current);
free_fs_struct(copied_fs);
out_unlock:
unlock_dir(lower_parent_dentry);
@@ -249,8 +254,11 @@ static int sdcardfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
unlock_dir(lower_parent_dentry);
goto out_unlock;
}
+ copied_fs->umask = 0;
+ task_lock(current);
current->fs = copied_fs;
- current->fs->umask = 0;
+ task_unlock(current);
+
err = vfs_mkdir2(lower_mnt, d_inode(lower_parent_dentry), lower_dentry, mode);
if (err) {
@@ -318,7 +326,10 @@ static int sdcardfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
}
}
out:
+ task_lock(current);
current->fs = saved_fs;
+ task_unlock(current);
+
free_fs_struct(copied_fs);
out_unlock:
sdcardfs_put_lower_path(dentry, &lower_path);