summaryrefslogtreecommitdiff
path: root/fs/ext4
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2017-09-05 17:51:23 +0100
committerDan Williams <dan.j.williams@intel.com>2017-09-05 10:02:08 -0700
commitaed9eb1b21e85a846c805bc299bbb9d039d4a95b (patch)
tree33b3f3595916573d2e69f215ce4fcb29ad37a9c3 /fs/ext4
parent9edcad53d673fb033c2da7c6c05d30737739fdf5 (diff)
ext4: fix null pointer dereference on sbi
In the case of a kzalloc failure when allocating sbi we end up with a null pointer dereference on sbi when assigning sbi->s_daxdev. Fix this by moving the assignment of sbi->s_daxdev to after the null pointer check of sbi. Detected by CoverityScan CID#1455379 ("Dereference before null check") Fixes: 5e405595e5bf ("ext4: perform dax_device lookup at mount") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/super.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3e58f952eddc..55772b2d05ee 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3401,10 +3401,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO;
ext4_group_t first_not_zeroed;
- sbi->s_daxdev = dax_dev;
if ((data && !orig_data) || !sbi)
goto out_free_base;
+ sbi->s_daxdev = dax_dev;
sbi->s_blockgroup_lock =
kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);
if (!sbi->s_blockgroup_lock)