]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
of: fdt: add missing allocation-failure check
authorJohan Hovold <johan@kernel.org>
Wed, 17 May 2017 15:29:09 +0000 (17:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 May 2017 13:46:16 +0000 (15:46 +0200)
commitc3f0eff47d38a9acfeed4e927cf4ab88ddeab766
treeeb2ed87ff08302b47db51aabe628f7f81cd36f18
parent5bc2cfba8984b3757a479818ca5ce50b5c613007
of: fdt: add missing allocation-failure check

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")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/of/fdt.c