Commit c4e90ec0 authored by Florin Malita's avatar Florin Malita Committed by Artem Bityutskiy

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: default avatarFlorin Malita <fmalita@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent 341e1a0c
...@@ -317,14 +317,13 @@ static int create_vtbl(const struct ubi_device *ubi, struct ubi_scan_info *si, ...@@ -317,14 +317,13 @@ static int create_vtbl(const struct ubi_device *ubi, struct ubi_scan_info *si,
return err; return err;
write_error: write_error:
kfree(new_seb); /* Maybe this physical eraseblock went bad, try to pick another one */
/* May be this physical eraseblock went bad, try to pick another one */ if (++tries <= 5)
if (++tries <= 5) {
err = ubi_scan_add_to_list(si, new_seb->pnum, new_seb->ec, err = ubi_scan_add_to_list(si, new_seb->pnum, new_seb->ec,
&si->corr); &si->corr);
kfree(new_seb);
if (!err) if (!err)
goto retry; goto retry;
}
out_free: out_free:
ubi_free_vid_hdr(ubi, vid_hdr); ubi_free_vid_hdr(ubi, vid_hdr);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment