Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32cba237 authored by Richard Weinberger's avatar Richard Weinberger Committed by Tatyana Brokhman
Browse files

UBI: Fix memory leak in ubi_attach_fastmap() error path



On error we have to free all three temporary lists.

Change-Id: I5667f3eb55be47bd0fcedf374f86021900743ecd
Reported-by: default avatarRichard Genoud <richard.genoud@gmail.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Git-commit: fe24c6e5f51ec5ea42d432f67618a084047a23ed
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarTatyana Brokhman <tlinder@codeaurora.org>
parent aa7597b9
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -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;
}
}