* [PATCH] mm/zswap: fix potential memory leak
@ 2021-01-25 1:32 Tian Tao
0 siblings, 0 replies; only message in thread
From: Tian Tao @ 2021-01-25 1:32 UTC (permalink / raw)
To: vitaly.wool, ddstreet, akpm, song.bao.hua, sjenning, dan.carpenter
Cc: linux-mm
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);
--
2.7.4
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-01-25 1:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-25 1:32 [PATCH] mm/zswap: fix potential memory leak Tian Tao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox