summaryrefslogtreecommitdiffstats
path: root/mm/memory_hotplug.c
diff options
context:
space:
mode:
authorGustavo A. R. Silva <garsilva@embeddedor.com>2017-07-10 15:47:23 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-10 16:32:30 -0700
commitdbac61a3f2afac562efa51b0a196ed71b6b8d109 (patch)
treec9bbf5dd8f0a086143df9908146ea8ece1d9bb28 /mm/memory_hotplug.c
parent06226226773d56685de6ee9eb3f5d668e9f772ee (diff)
downloadlinux-dbac61a3f2afac562efa51b0a196ed71b6b8d109.tar.gz
linux-dbac61a3f2afac562efa51b0a196ed71b6b8d109.tar.bz2
linux-dbac61a3f2afac562efa51b0a196ed71b6b8d109.zip
mm/memory_hotplug.c: add NULL check to avoid potential NULL pointer dereference
The NULL check at line 1226: if (!pgdat), implies that pointer pgdat might be NULL. rollback_node_hotadd() dereferences this pointer. Add NULL check to avoid a potential NULL pointer dereference. Addresses-Coverity-ID: 1369133 Link: http://lkml.kernel.org/r/20170530212436.GA6195@embeddedgus Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory_hotplug.c')
-rw-r--r--mm/memory_hotplug.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index f79aac7a12b5..7b1311ac5f7b 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1268,7 +1268,7 @@ register_fail:
error:
/* rollback pgdat allocation and others */
- if (new_pgdat)
+ if (new_pgdat && pgdat)
rollback_node_hotadd(nid, pgdat);
memblock_remove(start, size);