Unionfs: ->setattr fixes
authorErez Zadok <ezk@cs.sunysb.edu>
Sun, 6 Mar 2011 21:02:20 +0000 (16:02 -0500)
committerErez Zadok <ezk@cs.sunysb.edu>
Sun, 6 Mar 2011 21:02:20 +0000 (16:02 -0500)
Call inode_check_ok first thing on our inode.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/inode.c

index f09d7e711425e381db7f481ee7e3dc31858ec6e4..d85efbf989a30e3fec8192dbb5936584e77b61d6 100644 (file)
@@ -888,6 +888,11 @@ static int unionfs_setattr(struct dentry *dentry, struct iattr *ia)
        int bstart, bend, bindex;
        loff_t size;
 
+       /* check if user has permission to change inode */
+       err = inode_change_ok(dentry->d_inode, ia);
+       if (err)
+               goto out_err;
+
        unionfs_read_lock(dentry->d_sb, UNIONFS_SMUTEX_CHILD);
        parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
@@ -996,7 +1001,7 @@ out:
        unionfs_unlock_dentry(dentry);
        unionfs_unlock_parent(dentry, parent);
        unionfs_read_unlock(dentry->d_sb);
-
+out_err:
        return err;
 }