summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorAlexey Romanov <avromanov@sberdevices.ru>2022-10-13 14:28:25 +0300
committerAndrew Morton <akpm@linux-foundation.org>2022-10-21 07:27:21 +0300
commit4249a05ff670e7b1aeea77f1a5451080ea86c88d (patch)
treeb8a5f83ae93d34f55c4a3119b5d8612691b09705 /mm
parent7329e3ebe3594b425955ab591ecea335e85842c2 (diff)
downloadlinux-4249a05ff670e7b1aeea77f1a5451080ea86c88d.tar.xz
zsmalloc: zs_destroy_pool: add size_class NULL check
Inside the zs_destroy_pool() function, there can still be NULL size_class pointers: if when the next size_class is allocated, inside zs_create_pool() function, kzalloc will return NULL and handling the error condition, zs_create_pool() will call zs_destroy_pool(). Link: https://lkml.kernel.org/r/20221013112825.61869-1-avromanov@sberdevices.ru Fixes: f24263a5a076 ("zsmalloc: remove unnecessary size_class NULL check") Signed-off-by: Alexey Romanov <avromanov@sberdevices.ru> Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org> Cc: Minchan Kim <minchan@kernel.org> Cc: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/zsmalloc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 525758713a55..d03941cace2c 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -2311,6 +2311,9 @@ void zs_destroy_pool(struct zs_pool *pool)
int fg;
struct size_class *class = pool->size_class[i];
+ if (!class)
+ continue;
+
if (class->index != i)
continue;