]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: fix up non-directory creation in SGID directories
authorChristoph Hellwig <hch@lst.de>
Sat, 23 Jan 2021 00:48:18 +0000 (16:48 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Sat, 23 Jan 2021 00:54:49 +0000 (16:54 -0800)
commit1db3fee044c460f25a88bb22b131e3b533eb4c30
tree49101114f070468688ccc7896db67d792cd92b1d
parent5a338c7aaa5e9c4f696cfb891f10c1babca12d74
xfs: fix up non-directory creation in SGID directories

XFS always inherits the SGID bit if it is set on the parent inode, while
the generic inode_init_owner does not do this in a few cases where it can
create a possible security problem, see commit ea228d760707
("Fix up non-directory creation in SGID directories") for details.

Switch XFS to use the generic helper for the normal path to fix this,
just keeping the simple field inheritance open coded for the case of the
non-sgid case with the bsdgrpid mount option.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
fs/xfs/xfs_inode.c