All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-memory_hotplug-prevent-accessing-by-index=-1.patch added to mm-unstable branch
@ 2024-06-11 21:42 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2024-06-11 21:42 UTC (permalink / raw)
  To: mm-commits, osalvador, david, abelova, akpm


The patch titled
     Subject: mm/memory_hotplug: prevent accessing by index=-1
has been added to the -mm mm-unstable branch.  Its filename is
     mm-memory_hotplug-prevent-accessing-by-index=-1.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-memory_hotplug-prevent-accessing-by-index=-1.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: Anastasia Belova <abelova@astralinux.ru>
Subject: mm/memory_hotplug: prevent accessing by index=-1
Date: Thu, 6 Jun 2024 11:06:59 +0300

nid may be equal to NUMA_NO_NODE=-1.  Prevent accessing node_data array by
invalid index with check for nid.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Link: https://lkml.kernel.org/r/20240606080659.18525-1-abelova@astralinux.ru
Fixes: e83a437faa62 ("mm/memory_hotplug: introduce "auto-movable" online policy")
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
Acked-by: David Hildenbrand <david@redhat.com>
Acked-by: Oscar Salvador <osalvador@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/memory_hotplug.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/mm/memory_hotplug.c~mm-memory_hotplug-prevent-accessing-by-index=-1
+++ a/mm/memory_hotplug.c
@@ -839,7 +839,6 @@ static bool auto_movable_can_online_mova
 	unsigned long kernel_early_pages, movable_pages;
 	struct auto_movable_group_stats group_stats = {};
 	struct auto_movable_stats stats = {};
-	pg_data_t *pgdat = NODE_DATA(nid);
 	struct zone *zone;
 	int i;
 
@@ -850,6 +849,8 @@ static bool auto_movable_can_online_mova
 			auto_movable_stats_account_zone(&stats, zone);
 	} else {
 		for (i = 0; i < MAX_NR_ZONES; i++) {
+			pg_data_t *pgdat = NODE_DATA(nid);
+
 			zone = pgdat->node_zones + i;
 			if (populated_zone(zone))
 				auto_movable_stats_account_zone(&stats, zone);
_

Patches currently in -mm which might be from abelova@astralinux.ru are

mm-memory_hotplug-prevent-accessing-by-index=-1.patch


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

only message in thread, other threads:[~2024-06-11 21:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-11 21:42 + mm-memory_hotplug-prevent-accessing-by-index=-1.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.