提交 fe24c6e5 编写于 作者: R Richard Weinberger 提交者: Artem Bityutskiy

UBI: Fix memory leak in ubi_attach_fastmap() error path

On error we have to free all three temporary lists.
Reported-by: NRichard Genoud <richard.genoud@gmail.com>
Signed-off-by: NRichard Weinberger <richard@nod.at>
Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
上级 55b80c40
...@@ -841,6 +841,19 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, ...@@ -841,6 +841,19 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
fail_bad: fail_bad:
ret = UBI_BAD_FASTMAP; ret = UBI_BAD_FASTMAP;
fail: fail:
list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &used, u.list) {
kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
list_del(&tmp_aeb->u.list);
}
list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &eba_orphans, u.list) {
kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
list_del(&tmp_aeb->u.list);
}
list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &free, u.list) {
kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
list_del(&tmp_aeb->u.list);
}
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册