Skip to content

Commit

Permalink
zsmalloc: zs_destroy_pool: add size_class NULL check
Browse files Browse the repository at this point in the history
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/[email protected]
Fixes: f24263a ("zsmalloc: remove unnecessary size_class NULL check")
Signed-off-by: Alexey Romanov <[email protected]>
Reviewed-by: Sergey Senozhatsky <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Nitin Gupta <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
mRrvz authored and akpm00 committed Oct 21, 2022
1 parent 7329e3e commit 4249a05
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mm/zsmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 4249a05

Please sign in to comment.