diff options
-rw-r--r-- | fs/btrfs/inode.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index ddb0f0ecda6c..8f0706210a47 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -3491,7 +3491,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
3491 | 3491 | ||
3492 | inode->i_uid = current_fsuid(); | 3492 | inode->i_uid = current_fsuid(); |
3493 | 3493 | ||
3494 | if (dir->i_mode & S_ISGID) { | 3494 | if (dir && (dir->i_mode & S_ISGID)) { |
3495 | inode->i_gid = dir->i_gid; | 3495 | inode->i_gid = dir->i_gid; |
3496 | if (S_ISDIR(mode)) | 3496 | if (S_ISDIR(mode)) |
3497 | mode |= S_ISGID; | 3497 | mode |= S_ISGID; |