]> git.baikalelectronics.ru Git - kernel.git/commit
reiserfs: fix problems with chowning setuid file w/ xattrs
authorJeff Mahoney <jeffm@suse.com>
Fri, 31 May 2013 19:54:17 +0000 (15:54 -0400)
committerJan Kara <jack@suse.cz>
Fri, 31 May 2013 21:14:11 +0000 (23:14 +0200)
commiteda794a6e624df4e6b9a6ce061d983a7355515b9
treee2009e9a11575062ed38fa464ea03801aa2c5594
parent5b4ec8d505bd5e954c611fb6a6fe0576729a2d5c
reiserfs: fix problems with chowning setuid file w/ xattrs

reiserfs_chown_xattrs() takes the iattr struct passed into ->setattr
and uses it to iterate over all the attrs associated with a file to change
ownership of xattrs (and transfer quota associated with the xattr files).

When the setuid bit is cleared during chown, ATTR_MODE and iattr->ia_mode
are passed to all the xattrs as well. This means that the xattr directory
will have S_IFREG added to its mode bits.

This has been prevented in practice by a missing IS_PRIVATE check
in reiserfs_acl_chmod, which caused a double-lock to occur while holding
the write lock. Since the file system was completely locked up, the
writeout of the corrupted mode never happened.

This patch temporarily clears everything but ATTR_UID|ATTR_GID for the
calls to reiserfs_setattr and adds the missing IS_PRIVATE check.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/reiserfs/xattr.c
fs/reiserfs/xattr_acl.c