aboutsummaryrefslogtreecommitdiff
path: root/sys/i386
diff options
context:
space:
mode:
authorYoshihiro Takahashi <nyan@FreeBSD.org>2007-09-01 12:18:28 +0000
committerYoshihiro Takahashi <nyan@FreeBSD.org>2007-09-01 12:18:28 +0000
commit7b226dfaa8f63c95e6defa6b2f61fb9062f0dd64 (patch)
tree9a6d5d8b87ad527e76588ccdd72ecb8e7526d9b8 /sys/i386
parent864cba96698bb9677fcc449f6af3fc4871d5cd23 (diff)
downloadsrc-7b226dfaa8f63c95e6defa6b2f61fb9062f0dd64.tar.gz
src-7b226dfaa8f63c95e6defa6b2f61fb9062f0dd64.zip
Fix a kernel panic due to a NULL pointer access on pc98.
When any PnP device exists, isa_release_resource() is called with no activated resource. So a bushandle is not allocated yet. Approved by: re (kensmith)
Notes
Notes: svn path=/head/; revision=172032
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/isa/isa.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/i386/isa/isa.c b/sys/i386/isa/isa.c
index b4abe7a7064a..a62c658136f3 100644
--- a/sys/i386/isa/isa.c
+++ b/sys/i386/isa/isa.c
@@ -244,11 +244,13 @@ isa_release_resource(device_t bus, device_t child, int type, int rid,
if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
bh = rman_get_bushandle(r);
- for (i = 1; i < bh->bsh_ressz; i++)
- resource_list_release(rl, bus, child, type, rid + i,
- bh->bsh_res[i]);
- if (bh->bsh_res != NULL)
- free(bh->bsh_res, M_DEVBUF);
+ if (bh != NULL) {
+ for (i = 1; i < bh->bsh_ressz; i++)
+ resource_list_release(rl, bus, child, type,
+ rid + i, bh->bsh_res[i]);
+ if (bh->bsh_res != NULL)
+ free(bh->bsh_res, M_DEVBUF);
+ }
}
#endif
return resource_list_release(rl, bus, child, type, rid, r);