summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2008-07-30 14:06:22 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-23 05:13:27 -0400
commita77b72da24ecfe262760874c55e3f6461f1dec0d (patch)
tree36c8c0215866099d03fb99aa5d13f765f2c73dba /fs
parent2c512397ca060f6dbcb3957174a91e29a3b769be (diff)
downloadop-kernel-dev-a77b72da24ecfe262760874c55e3f6461f1dec0d.zip
op-kernel-dev-a77b72da24ecfe262760874c55e3f6461f1dec0d.tar.gz
[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: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r--fs/attr.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/attr.c b/fs/attr.c
index 26c71ba..7a83819 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -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);
+ 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))
OpenPOWER on IntegriCloud