From: Phil Elwell Date: Fri, 13 Mar 2015 12:43:36 +0000 (+0000) Subject: Protect __release_resource against resources without parents X-Git-Tag: Ubuntu-raspi2-4.10.0-1019.22~253 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=d9eb4b486cf7e33c62eb3d88d0b30c94732f52e6;p=mirror_ubuntu-zesty-kernel.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;