Skip to content

Commit c4ab036

Browse files
author
Al Viro
committed
spufs: fix bogosity in S_ISGID handling
clearing everything *except* S_ISGID (including the S_IFDIR, among other things) is wrong. Just use init_inode_owner() and be done with that... Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent b577d0c commit c4ab036

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

  • arch/powerpc/platforms/cell/spufs

arch/powerpc/platforms/cell/spufs/inode.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,7 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags,
236236
if (!inode)
237237
return -ENOSPC;
238238

239-
if (dir->i_mode & S_ISGID) {
240-
inode->i_gid = dir->i_gid;
241-
inode->i_mode &= S_ISGID;
242-
}
239+
inode_init_owner(&init_user_ns, inode, dir, mode | S_IFDIR);
243240
ctx = alloc_spu_context(SPUFS_I(dir)->i_gang); /* XXX gang */
244241
SPUFS_I(inode)->i_ctx = ctx;
245242
if (!ctx) {
@@ -470,10 +467,7 @@ spufs_mkgang(struct inode *dir, struct dentry *dentry, umode_t mode)
470467
goto out;
471468

472469
ret = 0;
473-
if (dir->i_mode & S_ISGID) {
474-
inode->i_gid = dir->i_gid;
475-
inode->i_mode &= S_ISGID;
476-
}
470+
inode_init_owner(&init_user_ns, inode, dir, mode | S_IFDIR);
477471
gang = alloc_spu_gang();
478472
SPUFS_I(inode)->i_ctx = NULL;
479473
SPUFS_I(inode)->i_gang = gang;

0 commit comments

Comments
 (0)