diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 525758713a553d152084a0e3442e0f40fe132cf3..d03941cace2c492668f45a15ed0a3ffaa4924ab9 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;