提交 42f15d77 编写于 作者: C Chris Mason

Btrfs: Make sure dir is non-null before doing S_ISGID checks

The S_ISGID check in btrfs_new_inode caused an oops during subvol creation
because sometimes the dir is null.
Signed-off-by: NChris Mason <chris.mason@oracle.com>
上级 806638bc
...@@ -3491,7 +3491,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, ...@@ -3491,7 +3491,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
inode->i_uid = current_fsuid(); inode->i_uid = current_fsuid();
if (dir->i_mode & S_ISGID) { if (dir && (dir->i_mode & S_ISGID)) {
inode->i_gid = dir->i_gid; inode->i_gid = dir->i_gid;
if (S_ISDIR(mode)) if (S_ISDIR(mode))
mode |= S_ISGID; mode |= S_ISGID;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册