Skip to content

Commit

Permalink
UBI: fix dereference after kfree
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Florin Malita authored and Artem Bityutskiy committed Jul 18, 2007
1 parent 341e1a0 commit c4e90ec
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/mtd/ubi/vtbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,13 @@ static int create_vtbl(const struct ubi_device *ubi, struct ubi_scan_info *si,
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;
Expand Down

0 comments on commit c4e90ec

Please sign in to comment.