]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Protect __release_resource against resources without parents
authorPhil Elwell <phil@raspberrypi.org>
Fri, 13 Mar 2015 12:43:36 +0000 (12:43 +0000)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 9 Mar 2018 15:20:47 +0000 (12:20 -0300)
Without this patch, removing a device tree overlay can crash here.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
kernel/resource.c

index 9b5f04404152c296af3a96132f27cfc80ffa9af9..f8a9af6e6b915812be2ba2c1c2b4010644bdc882 100644 (file)
@@ -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;