From: Greg Kroah-Hartman Date: Mon, 20 Jun 2022 10:17:20 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v5.4.200~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=267df36aa39ea39cbe6e75df890066140967395d;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: mm-page_alloc-validate-buddy-before-check-its-migratetype.patch virtio-pci-remove-wrong-address-verification-in-vp_del_vqs.patch --- diff --git a/queue-4.14/mm-page_alloc-validate-buddy-before-check-its-migratetype.patch b/queue-4.14/mm-page_alloc-validate-buddy-before-check-its-migratetype.patch new file mode 100644 index 00000000000..59bbce41cb8 --- /dev/null +++ b/queue-4.14/mm-page_alloc-validate-buddy-before-check-its-migratetype.patch @@ -0,0 +1,39 @@ +From 787af64d05cd528aac9ad16752d11bb1c6061bb9 Mon Sep 17 00:00:00 2001 +From: Zi Yan +Date: Wed, 30 Mar 2022 15:45:43 -0700 +Subject: mm: page_alloc: validate buddy before check its migratetype. + +From: Zi Yan + +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 +Signed-off-by: Zi Yan +Signed-off-by: Linus Torvalds +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 +Signed-off-by: Greg Kroah-Hartman +--- + mm/page_alloc.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -866,6 +866,9 @@ continue_merging: + + buddy_pfn = __find_buddy_pfn(pfn, order); + buddy = page + (buddy_pfn - pfn); ++ ++ if (!page_is_buddy(page, buddy, order)) ++ goto done_merging; + buddy_mt = get_pageblock_migratetype(buddy); + + if (migratetype != buddy_mt diff --git a/queue-4.14/series b/queue-4.14/series index 68e489f05d8..7a8c64326c8 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -224,3 +224,5 @@ 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 +virtio-pci-remove-wrong-address-verification-in-vp_del_vqs.patch +mm-page_alloc-validate-buddy-before-check-its-migratetype.patch diff --git a/queue-4.14/virtio-pci-remove-wrong-address-verification-in-vp_del_vqs.patch b/queue-4.14/virtio-pci-remove-wrong-address-verification-in-vp_del_vqs.patch new file mode 100644 index 00000000000..ed2e18e9bce --- /dev/null +++ b/queue-4.14/virtio-pci-remove-wrong-address-verification-in-vp_del_vqs.patch @@ -0,0 +1,52 @@ +From 7e415282b41bf0d15c6e0fe268f822d9b083f2f7 Mon Sep 17 00:00:00 2001 +From: Murilo Opsfelder Araujo +Date: Thu, 14 Apr 2022 23:30:02 -0300 +Subject: virtio-pci: Remove wrong address verification in vp_del_vqs() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Murilo Opsfelder Araujo + +commit 7e415282b41bf0d15c6e0fe268f822d9b083f2f7 upstream. + +GCC 12 enhanced -Waddress when comparing array address to null [0], +which warns: + + drivers/virtio/virtio_pci_common.c: In function ‘vp_del_vqs’: + drivers/virtio/virtio_pci_common.c:257:29: warning: the comparison will always evaluate as ‘true’ for the pointer operand in ‘vp_dev->msix_affinity_masks + (sizetype)((long unsigned int)i * 256)’ must not be NULL [-Waddress] + 257 | if (vp_dev->msix_affinity_masks[i]) + | ^~~~~~ + +In fact, the verification is comparing the result of a pointer +arithmetic, the address "msix_affinity_masks + i", which will always +evaluate to true. + +Under the hood, free_cpumask_var() calls kfree(), which is safe to pass +NULL, not requiring non-null verification. So remove the verification +to make compiler happy (happy compiler, happy life). + +[0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102103 + +Signed-off-by: Murilo Opsfelder Araujo +Message-Id: <20220415023002.49805-1-muriloo@linux.ibm.com> +Signed-off-by: Michael S. Tsirkin +Acked-by: Christophe de Dinechin +Cc: Sudip Mukherjee +Signed-off-by: Greg Kroah-Hartman +--- + drivers/virtio/virtio_pci_common.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/virtio/virtio_pci_common.c ++++ b/drivers/virtio/virtio_pci_common.c +@@ -256,8 +256,7 @@ void vp_del_vqs(struct virtio_device *vd + + if (vp_dev->msix_affinity_masks) { + for (i = 0; i < vp_dev->msix_vectors; i++) +- if (vp_dev->msix_affinity_masks[i]) +- free_cpumask_var(vp_dev->msix_affinity_masks[i]); ++ free_cpumask_var(vp_dev->msix_affinity_masks[i]); + } + + if (vp_dev->msix_enabled) {