diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2012-05-16 07:22:21 -0400 |
---|---|---|
committer | Boaz Harrosh <bharrosh@panasas.com> | 2012-05-20 12:42:41 -0400 |
commit | 6abe4a87f7bc7978705c386dbba0ca0c7790b3ec (patch) | |
tree | 02f99246491cc2a76bdb592860537c63ee0ef480 /fs/exofs | |
parent | 36be50515fe2aef61533b516fa2576a2c7fe7664 (diff) |
exofs: Fix CRASH on very early IO errors.
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 <JSchild@gmx.de>
Stable: This is a bug since v3.2.0
CC: Stable Tree <stable@kernel.org>
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Diffstat (limited to 'fs/exofs')
-rw-r--r-- | fs/exofs/super.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/exofs/super.c b/fs/exofs/super.c index 735ca06430ac..59e0849772b7 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c | |||
@@ -745,7 +745,6 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent) | |||
745 | sbi->one_comp.obj.partition = opts->pid; | 745 | sbi->one_comp.obj.partition = opts->pid; |
746 | sbi->one_comp.obj.id = 0; | 746 | sbi->one_comp.obj.id = 0; |
747 | exofs_make_credential(sbi->one_comp.cred, &sbi->one_comp.obj); | 747 | exofs_make_credential(sbi->one_comp.cred, &sbi->one_comp.obj); |
748 | sbi->oc.numdevs = 1; | ||
749 | sbi->oc.single_comp = EC_SINGLE_COMP; | 748 | sbi->oc.single_comp = EC_SINGLE_COMP; |
750 | sbi->oc.comps = &sbi->one_comp; | 749 | sbi->oc.comps = &sbi->one_comp; |
751 | 750 | ||
@@ -804,6 +803,7 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent) | |||
804 | goto free_sbi; | 803 | goto free_sbi; |
805 | 804 | ||
806 | ore_comp_set_dev(&sbi->oc, 0, od); | 805 | ore_comp_set_dev(&sbi->oc, 0, od); |
806 | sbi->oc.numdevs = 1; | ||
807 | } | 807 | } |
808 | 808 | ||
809 | __sbi_read_stats(sbi); | 809 | __sbi_read_stats(sbi); |