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

Commit a77b72da authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Al Viro
Browse files

[patch] vfs: make security_inode_setattr() calling consistent



Call security_inode_setattr() consistetly before inode_change_ok().
It doesn't make sense to try to "optimize" the i_op->setattr == NULL
case, as most filesystem do define their own setattr function.

Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
parent 2c512397
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -159,17 +159,17 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
	if (!(attr->ia_valid & ~(ATTR_KILL_SUID | ATTR_KILL_SGID)))
		return 0;

	error = security_inode_setattr(dentry, attr);
	if (error)
		return error;

	if (ia_valid & ATTR_SIZE)
		down_write(&dentry->d_inode->i_alloc_sem);

	if (inode->i_op && inode->i_op->setattr) {
		error = security_inode_setattr(dentry, attr);
		if (!error)
		error = inode->i_op->setattr(dentry, attr);
	} else {
		error = inode_change_ok(inode, attr);
		if (!error)
			error = security_inode_setattr(dentry, attr);
		if (!error) {
			if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
			    (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid))