diff options
author | Zbigniew Bodek <zbb@FreeBSD.org> | 2014-11-07 19:34:10 +0000 |
---|---|---|
committer | Zbigniew Bodek <zbb@FreeBSD.org> | 2014-11-07 19:34:10 +0000 |
commit | 76a8ef267d1f3f290cb956282fb517af69537b3e (patch) | |
tree | 933f97ed748cba72eb84b19d884dff5f5085b7c7 /sys/dev/ofw/ofwbus.c | |
parent | d5cc4a4a6103dac099c380abc3b52bef4618d9aa (diff) |
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
Notes
Notes:
svn path=/head/; revision=274249
Diffstat (limited to 'sys/dev/ofw/ofwbus.c')
-rw-r--r-- | sys/dev/ofw/ofwbus.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/ofw/ofwbus.c b/sys/dev/ofw/ofwbus.c index 2b975ac1aa11..78da4810d9ae 100644 --- a/sys/dev/ofw/ofwbus.c +++ b/sys/dev/ofw/ofwbus.c @@ -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) |