-----Original Message----- From: tiantao (H) Sent: Monday, January 25, 2021 2:20 PM To: Song Bao Hua (Barry Song) song.bao.hua@hisilicon.com Cc: linuxarm@openeuler.org; tiantao (H) tiantao6@hisilicon.com Subject: [PATCH] mm/zswap: fix potential memory leak
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
Looks good to me. Thanks
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);
return 0; } spin_unlock(&tree->lock);kfree(tmp);
-- 2.7.4