git: 7204a656fcfa - stable/13 - acpi: Don't assume a resource is reserved in acpi_delete_resource
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 08 Apr 2024 20:25:54 UTC
The branch stable/13 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=7204a656fcfab41200a0056bb5dba0c538d93052
commit 7204a656fcfab41200a0056bb5dba0c538d93052
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-02-14 22:07:32 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-04-08 17:56:03 +0000
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)
---
sys/dev/acpica/acpi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index c4b87e39ce41..1706938e49a3 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -1534,7 +1534,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);
}