diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index fbb400193e9e..dae2f4ee06a6 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -1357,8 +1357,14 @@ static int zcache_cpu_notifier(struct notifier_block *nb, kp->objnodes[kp->nr - 1] = NULL; kp->nr--; } - kmem_cache_free(zcache_obj_cache, kp->obj); - free_page((unsigned long)kp->page); + if (kp->obj) { + kmem_cache_free(zcache_obj_cache, kp->obj); + kp->obj = NULL; + } + if (kp->page) { + free_page((unsigned long)kp->page); + kp->page = NULL; + } break; default: break;