mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
Protect __release_resource against resources without parents
Without this patch, removing a device tree overlay can crash here. Signed-off-by: Phil Elwell <phil@raspberrypi.org>
This commit is contained in:
@@ -192,6 +192,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;
|
||||
|
||||
Reference in New Issue
Block a user