mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
UBI: Fix memory leak in ubi_attach_fastmap() error path
On error we have to free all three temporary lists. Reported-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
This commit is contained in:
parent
55b80c409a
commit
fe24c6e5f5
1 changed files with 13 additions and 0 deletions
|
@ -841,6 +841,19 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
|
|||
fail_bad:
|
||||
ret = UBI_BAD_FASTMAP;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue