summaryrefslogtreecommitdiffstats
path: root/mm/ksm.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-11-22 09:49:08 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2019-11-22 09:49:08 -0800
commitcc079039c9b621868fd12bd457bf9b10a0fa68fc (patch)
tree96ed1f0cee4c8cd66b9bd593640c962159314a3b /mm/ksm.c
parenta6b0373ffcd8950b9121195e09c5d7c73e6e9f5d (diff)
parent9a63236f1ad82d71a98aa80320b6cb618fb32f44 (diff)
downloadlinux-cc079039c9b621868fd12bd457bf9b10a0fa68fc.tar.bz2
Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from Andrew Morton: "Three fixes" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: mm/ksm.c: don't WARN if page is still mapped in remove_stable_node() mm/memory_hotplug: don't access uninitialized memmaps in shrink_zone_span() Revert "fs: ocfs2: fix possible null-pointer dereferences in ocfs2_xa_prepare_entry()"
Diffstat (limited to 'mm/ksm.c')
-rw-r--r--mm/ksm.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/mm/ksm.c b/mm/ksm.c
index dbee2eb4dd05..7905934cd3ad 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -885,13 +885,13 @@ static int remove_stable_node(struct stable_node *stable_node)
return 0;
}
- if (WARN_ON_ONCE(page_mapped(page))) {
- /*
- * This should not happen: but if it does, just refuse to let
- * merge_across_nodes be switched - there is no need to panic.
- */
- err = -EBUSY;
- } else {
+ /*
+ * Page could be still mapped if this races with __mmput() running in
+ * between ksm_exit() and exit_mmap(). Just refuse to let
+ * merge_across_nodes/max_page_sharing be switched.
+ */
+ err = -EBUSY;
+ if (!page_mapped(page)) {
/*
* The stable node did not yet appear stale to get_ksm_page(),
* since that allows for an unmapped ksm page to be recognized