The patch titled Subject: mm-swap-use-a-global-swap-cluster-for-non-rotation-devices-fix has been added to the -mm mm-unstable branch. Its filename is mm-swap-use-a-global-swap-cluster-for-non-rotation-devices-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-swap-use-a-global-swap-cluster-for-non-rotation-devices-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: Kairui Song <ryncsn@xxxxxxxxx> Subject: mm-swap-use-a-global-swap-cluster-for-non-rotation-devices-fix Date: Wed, 15 Jan 2025 18:51:57 +0800 check kmalloc() return in setup_clusters Link: https://lkml.kernel.org/r/CAMgjq7Au+o04ckHyT=iU-wVx9az=t0B-ZiC5E0bDqNrAtNOP-g@xxxxxxxxxxxxxx Signed-off-by: Kairui Song <ryncsn@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/swapfile.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/mm/swapfile.c~mm-swap-use-a-global-swap-cluster-for-non-rotation-devices-fix +++ a/mm/swapfile.c @@ -3217,7 +3217,10 @@ static struct swap_cluster_info *setup_c local_lock_init(&cluster->lock); } } else { - si->global_cluster = kmalloc(sizeof(*si->global_cluster), GFP_KERNEL); + si->global_cluster = kmalloc(sizeof(*si->global_cluster), + GFP_KERNEL); + if (!si->global_cluster) + goto err_free; for (i = 0; i < SWAP_NR_ORDERS; i++) si->global_cluster->next[i] = SWAP_ENTRY_INVALID; spin_lock_init(&si->global_cluster_lock); _ Patches currently in -mm which might be from ryncsn@xxxxxxxxx are mm-swap-use-a-global-swap-cluster-for-non-rotation-devices-fix.patch