The patch titled Subject: mm-zswap-fix-potential-memory-corruption-on-duplicate-store-v2 has been added to the -mm mm-hotfixes-unstable branch. Its filename is mm-zswap-fix-potential-memory-corruption-on-duplicate-store-v2.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-zswap-fix-potential-memory-corruption-on-duplicate-store-v2.patch This patch will later appear in the mm-hotfixes-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Domenico Cerasuolo <cerasuolodomenico@xxxxxxxxx> Subject: mm-zswap-fix-potential-memory-corruption-on-duplicate-store-v2 Date: Mon, 25 Sep 2023 15:00:02 +0200 add a warning and a comment to the second duplicates check in zswap_store() (Johannes). Link: https://lkml.kernel.org/r/20230925130002.1929369-1-cerasuolodomenico@xxxxxxxxx Fixes: 42c06a0e8ebe ("mm: kill frontswap") Signed-off-by: Domenico Cerasuolo <cerasuolodomenico@xxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Nhat Pham <nphamcs@xxxxxxxxx> Cc: Dan Streetman <ddstreet@xxxxxxxx> Cc: Domenico Cerasuolo <cerasuolodomenico@xxxxxxxxx> Cc: Seth Jennings <sjenning@xxxxxxxxxx> Cc: Vitaly Wool <vitaly.wool@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/zswap.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/mm/zswap.c~mm-zswap-fix-potential-memory-corruption-on-duplicate-store-v2 +++ a/mm/zswap.c @@ -1346,7 +1346,14 @@ insert_entry: /* map */ spin_lock(&tree->lock); + /* + * A duplicate entry should have been removed at the beginning of this + * function. Since the swap entry should be pinned, if a duplicate is + * found again here it means that something went wrong in the swap + * cache. + */ while (zswap_rb_insert(&tree->rbroot, entry, &dupentry) == -EEXIST) { + WARN_ON(1); zswap_duplicate_entry++; zswap_invalidate_entry(tree, dupentry); } _ Patches currently in -mm which might be from cerasuolodomenico@xxxxxxxxx are mm-zswap-fix-potential-memory-corruption-on-duplicate-store.patch mm-zswap-fix-potential-memory-corruption-on-duplicate-store-v2.patch zswap-make-shrinking-memcg-aware.patch