Skip to content

Commit dbac61a

Browse files
GustavoARSilvatorvalds
authored andcommitted
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>
1 parent 0622622 commit dbac61a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎mm/memory_hotplug.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@ int __ref add_memory_resource(int nid, struct resource *res, bool online)
12681268

12691269
error:
12701270
/* rollback pgdat allocation and others */
1271-
if (new_pgdat)
1271+
if (new_pgdat && pgdat)
12721272
rollback_node_hotadd(nid, pgdat);
12731273
memblock_remove(start, size);
12741274

0 commit comments

Comments
 (0)