mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
Avoid panic in ofwbus caused by not released resource list entry
After resource allocation and release, resource list entry stays non-NULL. This causes panic in ofwbus_alloc_resource() on subsequent resource allocation. Clean appropriate list entry on release to avoid this. Obtained from: Semihalf Reviewed by: ian Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
d5cc4a4a61
commit
76a8ef267d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=274249
@ -399,11 +399,17 @@ ofwbus_adjust_resource(device_t bus, device_t child __unused, int type,
|
||||
}
|
||||
|
||||
static int
|
||||
ofwbus_release_resource(device_t bus __unused, device_t child, int type,
|
||||
ofwbus_release_resource(device_t bus, device_t child, int type,
|
||||
int rid, struct resource *r)
|
||||
{
|
||||
struct resource_list_entry *rle;
|
||||
int error;
|
||||
|
||||
/* Clean resource list entry */
|
||||
rle = resource_list_find(BUS_GET_RESOURCE_LIST(bus, child), type, rid);
|
||||
if (rle != NULL)
|
||||
rle->res = NULL;
|
||||
|
||||
if ((rman_get_flags(r) & RF_ACTIVE) != 0) {
|
||||
error = bus_deactivate_resource(child, type, rid, r);
|
||||
if (error)
|
||||
|
Loading…
Reference in New Issue
Block a user