aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Cox <alc@FreeBSD.org>2015-04-11 22:57:13 +0000
committerAlan Cox <alc@FreeBSD.org>2015-04-11 22:57:13 +0000
commit6a93e36b5f741e43bb250fde59d52fac4907a6fd (patch)
tree0ec70118e36d0bf7988451fc54a1e11fd91d023d
parent849d143dba6cd15e515e8357354cd3e83aeda61a (diff)
downloadsrc-6a93e36b5f741e43bb250fde59d52fac4907a6fd.tar.gz
src-6a93e36b5f741e43bb250fde59d52fac4907a6fd.zip
Correct an off-by-one error in vm_reserv_reclaim_contig() that results in
an infinite loop. Submitted by: Svatopluk Kraus MFC after: 1 week
Notes
Notes: svn path=/head/; revision=281444
-rw-r--r--sys/vm/vm_reserv.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/vm/vm_reserv.c b/sys/vm/vm_reserv.c
index 585a7494060c..b74c768f48e1 100644
--- a/sys/vm/vm_reserv.c
+++ b/sys/vm/vm_reserv.c
@@ -983,8 +983,18 @@ vm_reserv_reclaim_contig(u_long npages, vm_paddr_t low, vm_paddr_t high,
break;
} else if ((pa & (alignment - 1)) != 0 ||
((pa ^ (pa + size - 1)) & ~(boundary - 1)) != 0) {
- /* Continue with this reservation. */
- hi = lo;
+ /*
+ * The current page doesn't meet the alignment
+ * and/or boundary requirements. Continue
+ * searching this reservation until the rest
+ * of its free pages are either excluded or
+ * exhausted.
+ */
+ hi = lo + 1;
+ if (hi >= NBPOPMAP) {
+ hi = 0;
+ i++;
+ }
continue;
}
/* Find the next used page. */