Commit 5ca68834 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix for lockup in reiserfs acl/xattrs

From: Jeff Mahoney <jeffm@suse.com>

The following is a patch to fix a locking problem in ACL/xattr code. It
manifests when a user attempts to set an xattr on a file which they do
not own, and on which an ACL is applied.

What happens is this:
reiserfs_setxattr [write lock inode xattr sem]
  ->xattr_set
    -> lookup
       -> __reiserfs_permission [if conditions above are met, and need_lock=
 is
          unset, read lock inode xattr sem] *lockup*

Since we already keep track of when to lock during permission calls, the
fix is simple: just make the locking conditional as it was before.

Credits to Andreas Gruenbacher <agruen@suse.de>
parent 2804eb00
......@@ -1370,13 +1370,15 @@ __reiserfs_permission (struct inode *inode, int mask, struct nameidata *nd,
if (!(mode & S_IRWXG))
goto check_groups;
if (need_lock) {
reiserfs_read_lock_xattr_i (inode);
if (need_lock)
reiserfs_read_lock_xattrs (inode->i_sb);
}
acl = reiserfs_get_acl (inode, ACL_TYPE_ACCESS);
if (need_lock)
if (need_lock) {
reiserfs_read_unlock_xattrs (inode->i_sb);
reiserfs_read_unlock_xattr_i (inode);
}
if (IS_ERR (acl)) {
if (PTR_ERR (acl) == -ENODATA)
goto check_groups;
......
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