The patch titled Subject: mm-swapfile-__swap_duplicate-drop-redundant-write_once-on-swap_map-for-err-cases-fix has been added to the -mm mm-unstable branch. Its filename is mm-swapfile-__swap_duplicate-drop-redundant-write_once-on-swap_map-for-err-cases-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-swapfile-__swap_duplicate-drop-redundant-write_once-on-swap_map-for-err-cases-fix.patch This patch will later appear in the mm-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: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Subject: mm-swapfile-__swap_duplicate-drop-redundant-write_once-on-swap_map-for-err-cases-fix Date: Wed Feb 21 12:35:32 PM PST 2024 avoid using goto Cc: Barry Song <21cnbao@xxxxxxxxx> Cc: Barry Song <v-songbaohua@xxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/swapfile.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/mm/swapfile.c~mm-swapfile-__swap_duplicate-drop-redundant-write_once-on-swap_map-for-err-cases-fix +++ a/mm/swapfile.c @@ -3335,10 +3335,8 @@ static int __swap_duplicate(swp_entry_t } else err = -ENOENT; /* unused swap entry */ - if (err) - goto unlock_out; - - WRITE_ONCE(p->swap_map[offset], count | has_cache); + if (!err) + WRITE_ONCE(p->swap_map[offset], count | has_cache); unlock_out: unlock_cluster_or_swap_info(p, ci); _ Patches currently in -mm which might be from akpm@xxxxxxxxxxxxxxxxxxxx are mm-memory_hotplug-export-mhp_supports_memmap_on_memory-fix.patch kexec-split-crashkernel-reservation-code-out-from-crash_corec-fix.patch arch-crash-move-arch_crash_save_vmcoreinfo-out-to-file-vmcore_infoc-fix.patch mm-damon-dbgfs-make-debugfs-interface-deprecation-message-a-macro-fix.patch mm-ptdump-have-ptdump_check_wx-return-bool-fix.patch test_xarray-add-tests-for-advanced-multi-index-use-fix-fix.patch test_xarray-add-tests-for-advanced-multi-index-use-fix-fix-fix.patch mm-swapfile-__swap_duplicate-drop-redundant-write_once-on-swap_map-for-err-cases-fix.patch kprobes-use-synchronize_rcu_tasks_rude-in-kprobe_optimizer-fix.patch panic-add-option-to-dump-blocked-tasks-in-panic_print-fix.patch