Skip to content
Snippets Groups Projects
Commit 4ae7c4c7 authored by Daniel Rosenberg's avatar Daniel Rosenberg Committed by Roman Kiryanov
Browse files

ANDROID: sdcardfs: Change current->fs under lock


Adjusted from previous version to add missing include

(cherry picked from commit ea3a6005)

Bug: 111641492
Bug: 118443834
Reported-by: default avatarJann Horn <jannh@google.com>
Signed-off-by: default avatarRoman Kiryanov <rkir@google.com>
Change-Id: I0b112f9c57340ad33a65cc440a6aaca7faafac5f
parent 9b5af7af
No related branches found
No related tags found
No related merge requests found
...@@ -95,8 +95,11 @@ static int sdcardfs_create(struct inode *dir, struct dentry *dentry, ...@@ -95,8 +95,11 @@ static int sdcardfs_create(struct inode *dir, struct dentry *dentry,
err = -ENOMEM; err = -ENOMEM;
goto out_unlock; goto out_unlock;
} }
copied_fs->umask = 0;
task_lock(current);
current->fs = copied_fs; 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); err = vfs_create2(lower_dentry_mnt, d_inode(lower_parent_dentry), lower_dentry, mode, want_excl);
if (err) if (err)
goto out; goto out;
...@@ -110,7 +113,9 @@ static int sdcardfs_create(struct inode *dir, struct dentry *dentry, ...@@ -110,7 +113,9 @@ static int sdcardfs_create(struct inode *dir, struct dentry *dentry,
fixup_lower_ownership(dentry, dentry->d_name.name); fixup_lower_ownership(dentry, dentry->d_name.name);
out: out:
task_lock(current);
current->fs = saved_fs; current->fs = saved_fs;
task_unlock(current);
free_fs_struct(copied_fs); free_fs_struct(copied_fs);
out_unlock: out_unlock:
unlock_dir(lower_parent_dentry); unlock_dir(lower_parent_dentry);
...@@ -312,8 +317,11 @@ static int sdcardfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode ...@@ -312,8 +317,11 @@ static int sdcardfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
unlock_dir(lower_parent_dentry); unlock_dir(lower_parent_dentry);
goto out_unlock; goto out_unlock;
} }
copied_fs->umask = 0;
task_lock(current);
current->fs = copied_fs; current->fs = copied_fs;
current->fs->umask = 0; task_unlock(current);
err = vfs_mkdir2(lower_mnt, d_inode(lower_parent_dentry), lower_dentry, mode); err = vfs_mkdir2(lower_mnt, d_inode(lower_parent_dentry), lower_dentry, mode);
if (err) { if (err) {
...@@ -373,7 +381,10 @@ static int sdcardfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode ...@@ -373,7 +381,10 @@ static int sdcardfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
} }
} }
out: out:
task_lock(current);
current->fs = saved_fs; current->fs = saved_fs;
task_unlock(current);
free_fs_struct(copied_fs); free_fs_struct(copied_fs);
out_unlock: out_unlock:
sdcardfs_put_lower_path(dentry, &lower_path); sdcardfs_put_lower_path(dentry, &lower_path);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment