From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <garsilva@embeddedor.com>
Subject: [PATCH] mm: add NULL check to avoid potential NULL pointer dereference
Date: Tue, 30 May 2017 16:24:36 -0500 [thread overview]
Message-ID: <20170530212436.GA6195@embeddedgus> (raw)
NULL check at line 1226: if (!pgdat), implies that pointer pgdat
might be NULL.
Function rollback_node_hotadd() dereference this pointer.
Add NULL check to avoid a potential NULL pointer dereference.
Addresses-Coverity-ID: 1369133
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
mm/memory_hotplug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 599c675..ea3bc3e 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1273,7 +1273,7 @@ int __ref add_memory_resource(int nid, struct resource *res, bool online)
error:
/* rollback pgdat allocation and others */
- if (new_pgdat)
+ if (new_pgdat && pgdat)
rollback_node_hotadd(nid, pgdat);
memblock_remove(start, size);
--
2.5.0
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <garsilva@embeddedor.com>
Subject: [PATCH] mm: add NULL check to avoid potential NULL pointer dereference
Date: Tue, 30 May 2017 16:24:36 -0500 [thread overview]
Message-ID: <20170530212436.GA6195@embeddedgus> (raw)
NULL check at line 1226: if (!pgdat), implies that pointer pgdat
might be NULL.
Function rollback_node_hotadd() dereference this pointer.
Add NULL check to avoid a potential NULL pointer dereference.
Addresses-Coverity-ID: 1369133
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
mm/memory_hotplug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 599c675..ea3bc3e 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1273,7 +1273,7 @@ int __ref add_memory_resource(int nid, struct resource *res, bool online)
error:
/* rollback pgdat allocation and others */
- if (new_pgdat)
+ if (new_pgdat && pgdat)
rollback_node_hotadd(nid, pgdat);
memblock_remove(start, size);
--
2.5.0
next reply other threads:[~2017-05-30 21:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-30 21:24 Gustavo A. R. Silva [this message]
2017-05-30 21:24 ` [PATCH] mm: add NULL check to avoid potential NULL pointer dereference Gustavo A. R. Silva
2017-05-31 15:09 ` Michal Hocko
2017-05-31 15:09 ` Michal Hocko
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=20170530212436.GA6195@embeddedgus \
--to=garsilva@embeddedor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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 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.