[PATCH] zswap: initialize entry->pool on same filled entry

From: Chris Li
Date: Thu Mar 21 2024 - 19:53:29 EST


Current zswap will leave the entry->pool uninitialized if
the page is same  filled. The entry->pool pointer can
contain data written by previous usage.

Initialize entry->pool to zero for the same filled zswap entry.

Signed-off-by: Chris Li <chrisl@xxxxxxxxxx>
---
Per Yosry's suggestion to split out this clean up
from the zxwap rb tree to xarray patch.

https://lore.kernel.org/all/ZemDuW25YxjqAjm-@xxxxxxxxxx/
---
mm/zswap.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/mm/zswap.c b/mm/zswap.c
index b31c977f53e9..f04a75a36236 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -1527,6 +1527,7 @@ bool zswap_store(struct folio *folio)
kunmap_local(src);
entry->length = 0;
entry->value = value;
+ entry->pool = 0;
atomic_inc(&zswap_same_filled_pages);
goto insert_entry;
}

---
base-commit: a824831a082f1d8f9b51a4c0598e633d38555fcf
change-id: 20240315-zswap-fill-f65f44574760

Best regards,
--
Chris Li <chrisl@xxxxxxxxxx>