Commit 2888a220 authored by Jeff Mahoney's avatar Jeff Mahoney Committed by Linus Torvalds

[PATCH] reiserfs: xattr/acl fixes

Here are a few fixes for bugs noticed on reiserfs-list or our own bugzilla.

Attached is a patch that fixes several problems with xattrs/acls:
[SECURITY] Fixes the inode not getting dirtied when mode is set
           via setxattr()
[CORRECTNESS] Fixes the inode not getting ctime updated when an xattr is
              removed
[DATA] Fixes an issue with dcache hash colliding names in the filesystem
       root caused by the d_compare to hide .reiserfs_priv. The bug
       can only occur in the filesystem root, which is why we haven't
       seen many (any, outside of the suse bugzilla, afaik) reports on
       this. The results are that dcache operations on colliding entries
       in the fs root will choose the first match rather than the
       correct entry.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2b2fea83
......@@ -761,6 +761,11 @@ reiserfs_xattr_del (struct inode *inode, const char *name)
err = __reiserfs_xattr_del (dir, name, strlen (name));
dput (dir);
if (!err) {
inode->i_ctime = CURRENT_TIME;
mark_inode_dirty (inode);
}
out:
return err;
}
......@@ -1240,8 +1245,10 @@ xattr_lookup_poison (struct dentry *dentry, struct qstr *q1, struct qstr *name)
name->hash == priv_root->d_name.hash &&
!memcmp (name->name, priv_root->d_name.name, name->len)) {
return -ENOENT;
}
} else if (q1->len == name->len &&
!memcmp(q1->name, name->name, name->len))
return 0;
return 1;
}
static struct dentry_operations xattr_lookup_poison_ops = {
......
......@@ -289,9 +289,15 @@ reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
error = reiserfs_xattr_set(inode, name, value, size, 0);
} else {
error = reiserfs_xattr_del (inode, name);
if (error == -ENODATA)
if (error == -ENODATA) {
/* This may seem odd here, but it means that the ACL was set
* with a value representable with mode bits. If there was
* an ACL before, reiserfs_xattr_del already dirtied the inode.
*/
mark_inode_dirty (inode);
error = 0;
}
}
if (value)
kfree(value);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment