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)
This commit is contained in:
Yoshihiro Takahashi 2007-09-01 12:18:28 +00:00
parent 864cba9669
commit 7b226dfaa8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=172032

View file

@ -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);