1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-12 09:58:36 +00:00

vm_phys: add essential segment bounds check

A lower-bound segment check is necessary in vm_phys_alloc_seg_contig.
Add one.

Reported by:	jenkins
Reviewed by:	alc
Fixes:	da92ecbc0d vm_phys: fix seg->end test in alloc_seg_contig
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D33945
This commit is contained in:
Doug Moore 2022-01-19 00:42:39 -06:00
parent 89d57b94d7
commit 0ce7909cd0

View File

@ -1451,7 +1451,8 @@ vm_phys_alloc_seg_contig(struct vm_phys_seg *seg, u_long npages,
* (without overflow in pa_end calculation)
* and fits within the segment.
*/
if (pa_end < pa || pa_end > seg->end)
if (pa_end < pa ||
pa < seg->start || seg->end < pa_end)
continue;
/*