From: David Hildenbrand <david@redhat.com>
To: Anastasia Belova <abelova@astralinux.ru>
Cc: Oscar Salvador <osalvador@suse.de>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
lvc-project@linuxtesting.org
Subject: Re: [PATCH v2] mm/memory_hotplug: prevent accessing by index=-1
Date: Thu, 6 Jun 2024 10:13:48 +0200 [thread overview]
Message-ID: <01c1e542-867a-437f-8abd-8f06cf3812cf@redhat.com> (raw)
In-Reply-To: <20240606080659.18525-1-abelova@astralinux.ru>
On 06.06.24 10:06, Anastasia Belova wrote:
> 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.
>
> Fixes: e83a437faa62 ("mm/memory_hotplug: introduce "auto-movable" online policy")
> Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
> ---
> mm/memory_hotplug.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 431b1f6753c0..db78d1b725fc 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -846,7 +846,6 @@ static bool auto_movable_can_online_movable(int nid, struct memory_group *group,
> 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;
>
> @@ -857,6 +856,8 @@ static bool auto_movable_can_online_movable(int nid, struct memory_group *group,
> 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);
Acked-by: David Hildenbrand <david@redhat.com>
Thanks!
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2024-06-06 8:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-03 11:28 [PATCH] " Anastasia Belova
2024-06-03 16:07 ` David Hildenbrand
2024-06-03 17:53 ` Oscar Salvador
2024-06-03 17:58 ` David Hildenbrand
2024-06-03 19:54 ` Fedor Pchelkin
2024-06-03 20:15 ` David Hildenbrand
2024-06-06 8:06 ` [PATCH v2] " Anastasia Belova
2024-06-06 8:13 ` David Hildenbrand [this message]
2024-06-07 7:34 ` Oscar Salvador
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=01c1e542-867a-437f-8abd-8f06cf3812cf@redhat.com \
--to=david@redhat.com \
--cc=abelova@astralinux.ru \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lvc-project@linuxtesting.org \
--cc=osalvador@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®