aboutsummaryrefslogtreecommitdiffstats
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 09:52:22 -0400
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 b6fd6bbd941e..83236c31c892 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -317,14 +317,13 @@ retry:
317 return err; 317 return err;
318 318
319write_error: 319write_error:
320 kfree(new_seb); 320 /* Maybe this physical eraseblock went bad, try to pick another one */
321 /* May be this physical eraseblock went bad, try to pick another one */ 321 if (++tries <= 5)
322 if (++tries <= 5) {
323 err = ubi_scan_add_to_list(si, new_seb->pnum, new_seb->ec, 322 err = ubi_scan_add_to_list(si, new_seb->pnum, new_seb->ec,
324 &si->corr); 323 &si->corr);
325 if (!err) 324 kfree(new_seb);
326 goto retry; 325 if (!err)
327 } 326 goto retry;
328out_free: 327out_free:
329 ubi_free_vid_hdr(ubi, vid_hdr); 328 ubi_free_vid_hdr(ubi, vid_hdr);
330 return err; 329 return err;