From: Phil Elwell Date: Fri, 13 Mar 2015 12:43:36 +0000 (+0000) Subject: Protect __release_resource against resources without parents X-Git-Tag: accepted/tizen/unified/20230118.172025~1536 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=43e8fef083f8754bb00cbd15b573aa194f44d5a6;p=platform%2Fkernel%2Flinux-rpi.git Protect __release_resource against resources without parents Without this patch, removing a device tree overlay can crash here. Signed-off-by: Phil Elwell --- diff --git a/kernel/resource.c b/kernel/resource.c index ca9f519..dd5ac10 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -213,6 +213,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;