aboutsummaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorFlorin Malita <fmalita@gmail.com>2007-05-03 11:49:57 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-07-18 16:52:22 +0300
commitc4e90ec0134d7bedebbe3fe58ed5d431293886d4 (patch)
treebce3d8a6243de9400465f9eba029295522853de9 /drivers/mtd
parent341e1a0cf2d8965c8b2f7941a6b2f2c2170df469 (diff)
UBI: fix dereference after kfree
Coverity (CID 1614) spotted new_seb being dereferenced after kfree() in create_vtbl's write_error path. Signed-off-by: Florin Malita <fmalita@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/vtbl.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index b6fd6bbd941..83236c31c89 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -317,14 +317,13 @@ retry:
return err;
write_error:
- kfree(new_seb);
- /* May be this physical eraseblock went bad, try to pick another one */
- if (++tries <= 5) {
+ /* 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);
- if (!err)
- goto retry;
- }
+ kfree(new_seb);
+ if (!err)
+ goto retry;
out_free:
ubi_free_vid_hdr(ubi, vid_hdr);
return err;