Protect __release_resource against resources without parents

Without this patch, removing a device tree overlay can crash here.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
This commit is contained in:
Phil Elwell
2015-03-13 12:43:36 +00:00
committed by Dom Cobley
parent d2e399b236
commit dd262ccc97

View File

@@ -192,6 +192,12 @@ static int __release_resource(struct resource *old, bool release_child)
{
struct resource *tmp, **p, *chd;
if (!old->parent) {
WARN(old->sibling, "sibling but no parent");
if (old->sibling)
return -EINVAL;
return 0;
}
p = &old->parent->child;
for (;;) {
tmp = *p;