xfs: Correctly lock inode when removing suid and file capabilities
authorJan Kara <jack@suse.cz>
Thu, 21 May 2015 14:05:56 +0000 (16:05 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 23 Jun 2015 22:01:10 +0000 (18:01 -0400)
commita6de82cab123beaf9406024943caa0242f0618b0
tree747d73350fb02ca51306530630766dd28b8d0548
parent45f147a1bc97c743c6101a8d2741c69a51f583e4
xfs: Correctly lock inode when removing suid and file capabilities

Currently XFS calls file_remove_privs() without holding i_mutex. This is
wrong because that function can end up messing with file permissions and
file capabilities stored in xattrs for which we need i_mutex held.

Fix the problem by grabbing iolock exclusively when we will need to
change anything in permissions / xattrs.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/xfs/xfs_file.c