Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 48b08989 authored by Daniel Rosenberg's avatar Daniel Rosenberg Committed by Gerrit - the friendly Code Review server
Browse files

ANDROID: sdcardfs: Change current->fs under lock



bug: 111641492

Change-Id: I79e9894f94880048edaf0f7cfa2d180f65cbcf3b
Reported-by: default avatarJann Horn <jannh@google.com>
Signed-off-by: default avatarDaniel Rosenberg <drosen@google.com>
Git-repo: https://android.googlesource.com/kernel/msm


Git-commit: f7e8c1a229a138f53e7db63b5fc2dd9999dd8970
Signed-off-by: default avatarDennis Cagle <dcagle@codeaurora.org>
parent c04b5830
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -95,8 +95,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;
@@ -110,7 +113,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);
@@ -316,8 +321,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) {
@@ -377,7 +385,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);