From: Phil Elwell Date: Fri, 13 Mar 2015 12:43:36 +0000 (+0000) Subject: Protect __release_resource against resources without parents X-Git-Tag: archive/raspbian/4.9.82-1+deb9u3+rpi1_jessie~5^2~481 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d64806445b66c28326e3c27a748be69b43343a76;p=linux-4.9.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 9b5f04404152..f8a9af6e6b91 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -246,6 +246,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;