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.30-2+deb9u2+rpi1~4^2~964 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=07dd0619d10f40b1eac6f35b91416063fde5652e;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;