From de436809828aec2ee14a8372c5269c3b90bddaae Mon Sep 17 00:00:00 2001 From: Yurii Zubrytskyi Date: Thu, 18 Feb 2021 09:22:52 -0800 Subject: [PATCH] ANDROID: Incremental fs: set the correct access to mapped files Backing file needs to have write permissions for all users even though the mounted view doesn't - otherwise incfs can't change the internal file data. Bug: 180535478 Test: adb install Signed-off-by: Yurii Zubrytskyi Signed-off-by: Paul Lawrence Change-Id: I5d7915b28072cff1508ba45b56e844cb678ca466 --- fs/incfs/pseudo_files.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/incfs/pseudo_files.c b/fs/incfs/pseudo_files.c index ff4cb941a1d8..e51621fbf1af 100644 --- a/fs/incfs/pseudo_files.c +++ b/fs/incfs/pseudo_files.c @@ -863,6 +863,12 @@ static long ioctl_create_mapped_file(struct file *file, void __user *arg) if (error) goto out; + error = chmod(file_dentry, args.mode | 0222); + if (error) { + pr_debug("incfs: chmod err: %d\n", error); + goto delete_file; + } + /* Save the file's size as an xattr for easy fetching in future. */ size_attr_value = cpu_to_le64(args.size); error = vfs_setxattr(file_dentry, INCFS_XATTR_SIZE_NAME,