Commit a443db48 authored by Artem Bityutskiy's avatar Artem Bityutskiy

UBI: bugfix in ubi_leb_change()

Do not call 'ubi_wl_put_peb()' if the LEB was unmapped.
Reported-by: default avatarGabor Loki <loki@inf.u-szeged.hu>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent 3261ebd7
...@@ -891,12 +891,14 @@ int ubi_eba_atomic_leb_change(struct ubi_device *ubi, int vol_id, int lnum, ...@@ -891,12 +891,14 @@ int ubi_eba_atomic_leb_change(struct ubi_device *ubi, int vol_id, int lnum,
goto write_error; goto write_error;
} }
if (vol->eba_tbl[lnum] >= 0) {
err = ubi_wl_put_peb(ubi, vol->eba_tbl[lnum], 1); err = ubi_wl_put_peb(ubi, vol->eba_tbl[lnum], 1);
if (err) { if (err) {
ubi_free_vid_hdr(ubi, vid_hdr); ubi_free_vid_hdr(ubi, vid_hdr);
leb_write_unlock(ubi, vol_id, lnum); leb_write_unlock(ubi, vol_id, lnum);
return err; return err;
} }
}
vol->eba_tbl[lnum] = pnum; vol->eba_tbl[lnum] = pnum;
leb_write_unlock(ubi, vol_id, lnum); leb_write_unlock(ubi, vol_id, lnum);
......
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