aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Rosenberg <drosen@google.com>2017-01-20 15:19:13 -0800
committerArvin Quilao <arquilao@gmail.com>2017-03-07 04:06:46 +0000
commit07094e2a84ff1733f158d57cbe9532a679ed58c7 (patch)
tree934b41513dd5ccaeeb7a348f16ac9e77c1e7986b
parent9989d80a772227aeee6f13b3aac0d00ea5381dd5 (diff)
ANDROID: sdcardfs: Allow non-owners to touch
This modifies the permission checks in setattr to allow for non-owners to modify the timestamp of files to things other than the current time. This still requires write access, as enforced by the permission call, but relaxes the requirement that the caller must be the owner, allowing those with group permissions to change it as well. Bug: 11118565 Change-Id: Ied31f0cce2797675c7ef179eeb4e088185adcbad Signed-off-by: Daniel Rosenberg <drosen@google.com>
-rwxr-xr-xfs/sdcardfs/inode.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/sdcardfs/inode.c b/fs/sdcardfs/inode.c
index 892fe8cfb4c..53b2a7024d7 100755
--- a/fs/sdcardfs/inode.c
+++ b/fs/sdcardfs/inode.c
@@ -751,6 +751,11 @@ static int sdcardfs_setattr(struct vfsmount *mnt, struct dentry *dentry, struct
* this user can change the lower inode: that should happen when
* calling notify_change on the lower inode.
*/
+ /* prepare our own lower struct iattr (with the lower file) */
+ memcpy(&lower_ia, ia, sizeof(lower_ia));
+ /* Allow touch updating timestamps. A previous permission check ensures
+ * we have write access. Changes to mode, owner, and group are ignored*/
+ ia->ia_valid |= ATTR_FORCE;
err = inode_change_ok(&tmp, ia);
if (!err) {
@@ -776,8 +781,6 @@ static int sdcardfs_setattr(struct vfsmount *mnt, struct dentry *dentry, struct
lower_mnt = lower_path.mnt;
lower_inode = sdcardfs_lower_inode(inode);
- /* prepare our own lower struct iattr (with the lower file) */
- memcpy(&lower_ia, ia, sizeof(lower_ia));
if (ia->ia_valid & ATTR_FILE)
lower_ia.ia_file = sdcardfs_lower_file(ia->ia_file);