aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2024-02-14 22:07:32 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2024-04-08 17:55:58 +0000
commitcfb8cc9c5fa942ef51d3738851efd63ba0aeaccd (patch)
treea09fae75d3c68d34502dc7a398f9cb87c78021fb
parent13926bcb9779f8f2ba72ee25a094e179aa94d680 (diff)
acpi: Don't assume a resource is reserved in acpi_delete_resource
This fixes a panic if a driver uses bus_set_resource to add a resource that fails to reserve and then deletes the resource via bus_delete_resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D43891 (cherry picked from commit e05436d577de98944b97b9cf510b29c4d2091b3f)
-rw-r--r--sys/dev/acpica/acpi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 955c2b71b5ec..0894f4464162 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -1619,7 +1619,8 @@ acpi_delete_resource(device_t bus, device_t child, int type, int rid)
" (type=%d, rid=%d)\n", type, rid);
return;
}
- resource_list_unreserve(rl, bus, child, type, rid);
+ if (resource_list_reserved(rl, type, rid))
+ resource_list_unreserve(rl, bus, child, type, rid);
resource_list_delete(rl, type, rid);
}