diff options
author | scottl <scottl@FreeBSD.org> | 2007-02-23 22:53:56 +0000 |
---|---|---|
committer | scottl <scottl@FreeBSD.org> | 2007-02-23 22:53:56 +0000 |
commit | 31cea9b6ce62fe4437015ebf0d37e3a2d979cfcd (patch) | |
tree | 4b631a2591cb20c889b7a2d990a0c9630e08afea /sys/kern/subr_rman.c | |
parent | 902cc4aebabcbc802991bdb0b03f04e600fd8452 (diff) | |
download | FreeBSD-src-31cea9b6ce62fe4437015ebf0d37e3a2d979cfcd.zip FreeBSD-src-31cea9b6ce62fe4437015ebf0d37e3a2d979cfcd.tar.gz |
Fix a case in rman_manage_region() where the resource list would get missorted.
This would in turn confuse rman_reserve_resource(). This was only seen for
MSI resources that can get allocated and deallocated after boot.
Diffstat (limited to 'sys/kern/subr_rman.c')
-rw-r--r-- | sys/kern/subr_rman.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/kern/subr_rman.c b/sys/kern/subr_rman.c index b17ea74..609814e 100644 --- a/sys/kern/subr_rman.c +++ b/sys/kern/subr_rman.c @@ -209,13 +209,14 @@ rman_manage_region(struct rman *rm, u_long start, u_long end) s->r_end = r->r_end; free(r, M_RMAN); } - } else { + } else if (t != NULL) { /* Can we merge with just the next region? */ - if (t != NULL) { - t->r_start = r->r_start; - free(r, M_RMAN); - } else - TAILQ_INSERT_BEFORE(s, r, r_link); + t->r_start = r->r_start; + free(r, M_RMAN); + } else if (s->r_end < r->r_start) { + TAILQ_INSERT_AFTER(&rm->rm_list, s, r, r_link); + } else { + TAILQ_INSERT_BEFORE(s, r, r_link); } } |