Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42f15d77 authored by Chris Mason's avatar Chris Mason
Browse files

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: default avatarChris Mason <chris.mason@oracle.com>
parent 806638bc
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -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;