summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/vtbl.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-05-05 11:24:02 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-07-18 16:52:32 +0300
commit78d87c95b89ccf86c142494beada3082810ed368 (patch)
treebb2bc3d2b11e2990376d25e13c94aeb50380a0c4 /drivers/mtd/ubi/vtbl.c
parentc4e90ec0134d7bedebbe3fe58ed5d431293886d4 (diff)
UBI: fix error path in create_vtbl()
There were several bugs in volume table creation error path. Thanks to Satyam Sharma <satyam.sharma@gmail.com> and Florin Malita <fmalita@gmail.com> for finding and analysing them: http://lkml.org/lkml/2007/5/3/274 This patch makes ubi_scan_add_to_list() static and renames it to add_to_list(), just because it is not needed outside scan.c anymore. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/vtbl.c')
-rw-r--r--drivers/mtd/ubi/vtbl.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index 83236c31c89..9926f1f9aad 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -317,13 +317,15 @@ retry:
return err;
write_error:
- /* Maybe this physical eraseblock went bad, try to pick another one */
- if (++tries <= 5)
- err = ubi_scan_add_to_list(si, new_seb->pnum, new_seb->ec,
- &si->corr);
- kfree(new_seb);
- if (!err)
+ if (err == -EIO && ++tries <= 5) {
+ /*
+ * Probably this physical eraseblock went bad, try to pick
+ * another one.
+ */
+ list_add_tail(&new_seb->u.list, &si->corr);
goto retry;
+ }
+ kfree(new_seb);
out_free:
ubi_free_vid_hdr(ubi, vid_hdr);
return err;