diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-02-06 11:35:57 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-02-06 11:35:57 -0500 |
commit | 42f15d77df8a7e8a2feb15041d5d30710ee7f951 (patch) | |
tree | 5b6a3cdaab135c41848952874a6fab086b8b9f72 /fs/btrfs/inode.c | |
parent | 806638bce99f51deccbfedbe86ab3c5cf55a1d35 (diff) | |
download | linux-42f15d77df8a7e8a2feb15041d5d30710ee7f951.tar.gz linux-42f15d77df8a7e8a2feb15041d5d30710ee7f951.tar.bz2 linux-42f15d77df8a7e8a2feb15041d5d30710ee7f951.zip |
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: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-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, 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; |