Skip to contentSkip to conversation

Patch "of: fdt: add missing allocation-failure check" has been added to the 3.18-stable tree

PATCH [email protected] 1 participant 1 message May 22, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

of: fdt: add missing allocation-failure check

to the 3.18-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
of-fdt-add-missing-allocation-failure-check.patch
and it can be found in the queue-3.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 49e67dd17649b60b4d54966e18ec9c80198227f0 Mon Sep 17 00:00:00 2001

From: Johan Hovold <[email protected]>
Date: Wed, 17 May 2017 17:29:09 +0200
Subject: of: fdt: add missing allocation-failure check

From: Johan Hovold <[email protected]>

commit 49e67dd17649b60b4d54966e18ec9c80198227f0 upstream.

The memory allocator passed to __unflatten_device_tree() (e.g. a wrapped kzalloc) can fail so add the missing sanity check to avoid dereferencing a NULL pointer.

Fixes fe14042358fa ("of/flattree: Refactor unflatten_device_tree and add fdt_unflatten_tree")
---
 drivers/of/fdt.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/of/fdt.c +3 -0
@@ -380,6 +380,9 @@ static void __unflatten_device_tree(void
 
 	/* Allocate memory for the expanded device tree */
 	mem = dt_alloc(size + 4, __alignof__(struct device_node));
+	if (!mem)
+		return NULL;
+
 	memset(mem, 0, size);
 
 	*(__be32 *)(mem + size) = cpu_to_be32(0xdeadbeef);

Patches currently in stable-queue which might be from [email protected] are

queue-3.18/watchdog-pcwd_usb-fix-null-deref-at-probe.patch queue-3.18/of-fdt-add-missing-allocation-failure-check.patch queue-3.18/ath9k_htc-fix-null-deref-at-probe.patch