提交 a443db48 编写于 作者: A Artem Bityutskiy

UBI: bugfix in ubi_leb_change()

Do not call 'ubi_wl_put_peb()' if the LEB was unmapped.
Reported-by: NGabor Loki <loki@inf.u-szeged.hu>
Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
上级 3261ebd7
......@@ -891,11 +891,13 @@ int ubi_eba_atomic_leb_change(struct ubi_device *ubi, int vol_id, int lnum,
goto write_error;
}
err = ubi_wl_put_peb(ubi, vol->eba_tbl[lnum], 1);
if (err) {
ubi_free_vid_hdr(ubi, vid_hdr);
leb_write_unlock(ubi, vol_id, lnum);
return err;
if (vol->eba_tbl[lnum] >= 0) {
err = ubi_wl_put_peb(ubi, vol->eba_tbl[lnum], 1);
if (err) {
ubi_free_vid_hdr(ubi, vid_hdr);
leb_write_unlock(ubi, vol_id, lnum);
return err;
}
}
vol->eba_tbl[lnum] = pnum;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册