lib-lru_cache-fix-error-free-handing-in-lc_create.patch removed from -mm tree
The quilt patch titled
Subject: lib/lru_cache: fix error free handing in lc_create
has been removed from the -mm tree. Its filename was
lib-lru_cache-fix-error-free-handing-in-lc_create.patch
This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: wuchi <[email protected]>
Subject: lib/lru_cache: fix error free handing in lc_create
Date: Sat, 18 Jun 2022 16:25:21 +0800
When kmem_cache_alloc in function lc_create returns null, we will free the memory already allocated. The loop of kmem_cache_free is wrong, especially:
i = 0 ==> do wrong loop
i > 0 ==> do not free element[0]
---
lib/lru_cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/lru_cache.c renamed from lib/lru_cache.c~lib-lru_cache-fix-error-free-handing-in-lc_create +2 -2
@@ -147,8 +147,8 @@ struct lru_cache *lc_create(const char *return lc;/* else: could not allocate all elements, give up */ -for (i--; i; i--) { -void *p = element[i]; +while (i) { +void *p = element[--i];kmem_cache_free (cache, p - e_off); }kfree (lc);
_
Patches currently in -mm which might be from [email protected] are
lib-debugobjects-fix-stat-count-and-optimize-debug_objects_mem_init.patch