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 4a88311c58
commit 97b0ece915

View File

@@ -210,6 +210,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;