]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Jun 2022 10:17:02 +0000 (12:17 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Jun 2022 10:17:02 +0000 (12:17 +0200)
added patches:
mm-page_alloc-validate-buddy-before-check-its-migratetype.patch

queue-4.9/mm-page_alloc-validate-buddy-before-check-its-migratetype.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/mm-page_alloc-validate-buddy-before-check-its-migratetype.patch b/queue-4.9/mm-page_alloc-validate-buddy-before-check-its-migratetype.patch
new file mode 100644 (file)
index 0000000..b03e19a
--- /dev/null
@@ -0,0 +1,39 @@
+From 787af64d05cd528aac9ad16752d11bb1c6061bb9 Mon Sep 17 00:00:00 2001
+From: Zi Yan <ziy@nvidia.com>
+Date: Wed, 30 Mar 2022 15:45:43 -0700
+Subject: mm: page_alloc: validate buddy before check its migratetype.
+
+From: Zi Yan <ziy@nvidia.com>
+
+commit 787af64d05cd528aac9ad16752d11bb1c6061bb9 upstream.
+
+Whenever a buddy page is found, page_is_buddy() should be called to
+check its validity.  Add the missing check during pageblock merge check.
+
+Fixes: 1dd214b8f21c ("mm: page_alloc: avoid merging non-fallbackable pageblocks with others")
+Link: https://lore.kernel.org/all/20220330154208.71aca532@gandalf.local.home/
+Reported-and-tested-by: Steven Rostedt <rostedt@goodmis.org>
+Signed-off-by: Zi Yan <ziy@nvidia.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Fixes: d9dddbf55667 ("mm/page_alloc: prevent merging between isolated and other pageblocks")
+Cc: stable@vger.kernel.org
+Reported-by: zjb194813@alibaba-inc.com
+Reported-by: tianhu.hh@alibaba-inc.com
+Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ mm/page_alloc.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/mm/page_alloc.c
++++ b/mm/page_alloc.c
+@@ -864,6 +864,9 @@ continue_merging:
+                       buddy_idx = __find_buddy_index(page_idx, order);
+                       buddy = page + (buddy_idx - page_idx);
++
++                      if (!page_is_buddy(page, buddy, order))
++                              goto done_merging;
+                       buddy_mt = get_pageblock_migratetype(buddy);
+                       if (migratetype != buddy_mt
index c9e8370e2052ed059def5fe6700ea3bb6d3f43ff..2f94686e3506b998f5b93f9bc7b36bfa45bc7791 100644 (file)
@@ -248,3 +248,4 @@ dm-mirror-log-round-up-region-bitmap-size-to-bits_per_long.patch
 ext4-fix-bug_on-ext4_mb_use_inode_pa.patch
 ext4-make-variable-count-signed.patch
 ext4-add-reserved-gdt-blocks-check.patch
+mm-page_alloc-validate-buddy-before-check-its-migratetype.patch