Skip to content

Commit

Permalink
Btrfs: Make sure dir is non-null before doing S_ISGID checks
Browse files Browse the repository at this point in the history
The S_ISGID check in btrfs_new_inode caused an oops during subvol creation
because sometimes the dir is null.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Chris Mason committed Feb 6, 2009
1 parent 806638b commit 42f15d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -3491,7 +3491,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,

inode->i_uid = current_fsuid();

if (dir->i_mode & S_ISGID) {
if (dir && (dir->i_mode & S_ISGID)) {
inode->i_gid = dir->i_gid;
if (S_ISDIR(mode))
mode |= S_ISGID;
Expand Down

0 comments on commit 42f15d7

Please sign in to comment.