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

Commit 37f547d7 authored by Amit Pundir's avatar Amit Pundir Committed by Daniel Rosenberg
Browse files

ANDROID: sdcardfs: Propagate dentry down to inode_change_ok()



Since commit 31051c85 ("fs: Give dentry to inode_change_ok()
instead of inode"), to avoid clearing of capabilities or security
related extended attributes too early, inode_change_ok() will
need to take dentry instead of inode. Propagate it down to
sdcardfs_setattr() and also rename it to setattr_prepare(),
otherwise we run into following build error:

  CC [M]  fs/sdcardfs/inode.o
fs/sdcardfs/inode.c: In function ‘sdcardfs_setattr’:
fs/sdcardfs/inode.c:644:8: error: implicit declaration of function ‘inode_change_ok’ [-Werror=implicit-function-declaration]
  err = inode_change_ok(inode, ia);
        ^

Change-Id: I714b4f4f68b7fea1ac82a71d2f323c76b11fa008
Signed-off-by: default avatarAmit Pundir <amit.pundir@linaro.org>
parent 69d9b544
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -706,6 +706,7 @@ static int sdcardfs_setattr(struct vfsmount *mnt, struct dentry *dentry, struct
	struct iattr lower_ia;
	struct dentry *parent;
	struct inode tmp;
	struct dentry tmp_d;
	struct inode *top;
	const struct cred *saved_cred = NULL;

@@ -736,13 +737,14 @@ static int sdcardfs_setattr(struct vfsmount *mnt, struct dentry *dentry, struct
	tmp.i_size = i_size_read(inode);
	release_top(SDCARDFS_I(inode));
	tmp.i_sb = inode->i_sb;
	tmp_d.d_inode = &tmp;

	/*
	 * Check if user has permission to change inode.  We don't check if
	 * Check if user has permission to change dentry.  We don't check if
	 * this user can change the lower inode: that should happen when
	 * calling notify_change on the lower inode.
	 */
	err = inode_change_ok(&tmp, ia);
	err = setattr_prepare(&tmp_d, ia);

	if (!err) {
		/* check the Android group ID */