]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
exofs: Fix CRASH on very early IO errors.
authorBoaz Harrosh <bharrosh@panasas.com>
Wed, 16 May 2012 11:22:21 +0000 (14:22 +0300)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 10 Jun 2012 13:41:33 +0000 (14:41 +0100)
commit 6abe4a87f7bc7978705c386dbba0ca0c7790b3ec upstream.

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
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/exofs/super.c

index e6085ec192d665ef2182625b1b4e0b1ccdb3e3d5..7ed500019fc34b14699e27cb15775072f94a75bf 100644 (file)
@@ -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;
 
@@ -803,6 +802,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);