If entry is NULL, the requested memory tmp should be freed, otherwise it may cause a memory leak.
Signed-off-by: Tian Tao tiantao6@hisilicon.com Reported-by: Dan Carpenter dan.carpenter@oracle.com --- mm/zswap.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/mm/zswap.c b/mm/zswap.c index 42d13dd..8d1381b 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -961,6 +961,7 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle) /* entry was invalidated */ spin_unlock(&tree->lock); zpool_unmap_handle(pool, handle); + kfree(tmp); return 0; } spin_unlock(&tree->lock);