mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-20 15:43:16 +00:00
Avoid spurious EINVAL in amd64 pmap_change_attr().
Do not try to change attributes for DMAP when working on a mapping which is not covered by the DMAP. This was reported on real system where a BAR of a device (NTB) was mapped outside the PCI window. Reported and tested by: mav Reviewed by: jhb, mav Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D6668
This commit is contained in:
parent
93ccd6bf87
commit
fc0924b9a4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=301457
@ -6533,7 +6533,7 @@ static int
|
|||||||
pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode)
|
pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode)
|
||||||
{
|
{
|
||||||
vm_offset_t base, offset, tmpva;
|
vm_offset_t base, offset, tmpva;
|
||||||
vm_paddr_t pa_start, pa_end;
|
vm_paddr_t pa_start, pa_end, pa_end1;
|
||||||
pdp_entry_t *pdpe;
|
pdp_entry_t *pdpe;
|
||||||
pd_entry_t *pde;
|
pd_entry_t *pde;
|
||||||
pt_entry_t *pte;
|
pt_entry_t *pte;
|
||||||
@ -6716,9 +6716,12 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode)
|
|||||||
tmpva += PAGE_SIZE;
|
tmpva += PAGE_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (error == 0 && pa_start != pa_end)
|
if (error == 0 && pa_start != pa_end && pa_start < dmaplimit) {
|
||||||
error = pmap_change_attr_locked(PHYS_TO_DMAP(pa_start),
|
pa_end1 = MIN(pa_end, dmaplimit);
|
||||||
pa_end - pa_start, mode);
|
if (pa_start != pa_end1)
|
||||||
|
error = pmap_change_attr_locked(PHYS_TO_DMAP(pa_start),
|
||||||
|
pa_end1 - pa_start, mode);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flush CPU caches if required to make sure any data isn't cached that
|
* Flush CPU caches if required to make sure any data isn't cached that
|
||||||
|
Loading…
Reference in New Issue
Block a user