All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-set-p-zeromap-to-null-after-freeing-it.patch added to mm-unstable branch
@ 2024-07-10 19:04 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2024-07-10 19:04 UTC (permalink / raw)
  To: mm-commits, yosryahmed, ying.huang, willy, shakeel.butt,
	oliver.sang, nphamcs, hughd, hannes, david, chengming.zhou, ak,
	usamaarif642, akpm


The patch titled
     Subject: mm: set p->zeromap to NULL after freeing it
has been added to the -mm mm-unstable branch.  Its filename is
     mm-set-p-zeromap-to-null-after-freeing-it.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-set-p-zeromap-to-null-after-freeing-it.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: Usama Arif <usamaarif642@gmail.com>
Subject: mm: set p->zeromap to NULL after freeing it
Date: Wed Jul 10 18:37:57 2024 +0100

alloc_swap_info can reuse swap_info_struct from previously used swap. 
Reset p->zeromap to NULL so that its not set to a corrupted pointer from
previous swap.

Signed-off-by: Usama Arif <usamaarif642@gmail.com>
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202407101031.c6c3c651-lkp@intel.com
Cc: Hugh Dickins <hughd@google.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: David Hildenbrand <david@redhat.com>
Cc: Huang Ying <ying.huang@intel.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/swapfile.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/mm/swapfile.c~mm-set-p-zeromap-to-null-after-freeing-it
+++ a/mm/swapfile.c
@@ -2654,6 +2654,7 @@ SYSCALL_DEFINE1(swapoff, const char __us
 	p->cluster_next_cpu = NULL;
 	vfree(swap_map);
 	kvfree(p->zeromap);
+	p->zeromap = NULL;
 	kvfree(cluster_info);
 	/* Destroy swap account information */
 	swap_cgroup_swapoff(p->type);
@@ -3346,6 +3347,7 @@ bad_swap:
 	spin_unlock(&swap_lock);
 	vfree(swap_map);
 	kvfree(p->zeromap);
+	p->zeromap = NULL;
 	kvfree(cluster_info);
 	if (inced_nr_rotate_swap)
 		atomic_dec(&nr_rotate_swap);
_

Patches currently in -mm which might be from usamaarif642@gmail.com are

mm-set-p-zeromap-to-null-after-freeing-it.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-07-10 19:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-10 19:04 + mm-set-p-zeromap-to-null-after-freeing-it.patch added to mm-unstable branch Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.