Skip to content

Commit

Permalink
exofs: Fix CRASH on very early IO errors.
Browse files Browse the repository at this point in the history
If at exofs_fill_super() we had an early termination
do to any error, like an IO error while reading the
super-block. We would crash inside exofs_free_sbi().

This is because sbi->oc.numdevs was set to 1, before
we actually have a device table at all.

Fix it by moving the sbi->oc.numdevs = 1 to after the
allocation of the device table.

Reported-by: Johannes Schild <[email protected]>

Stable: This is a bug since v3.2.0
CC: Stable Tree <[email protected]>
Signed-off-by: Boaz Harrosh <[email protected]>
  • Loading branch information
Boaz Harrosh committed May 20, 2012
1 parent 36be505 commit 6abe4a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/exofs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,6 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
sbi->one_comp.obj.partition = opts->pid;
sbi->one_comp.obj.id = 0;
exofs_make_credential(sbi->one_comp.cred, &sbi->one_comp.obj);
sbi->oc.numdevs = 1;
sbi->oc.single_comp = EC_SINGLE_COMP;
sbi->oc.comps = &sbi->one_comp;

Expand Down Expand Up @@ -804,6 +803,7 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
goto free_sbi;

ore_comp_set_dev(&sbi->oc, 0, od);
sbi->oc.numdevs = 1;
}

__sbi_read_stats(sbi);
Expand Down

0 comments on commit 6abe4a8

Please sign in to comment.