diff options
author | jhb <jhb@FreeBSD.org> | 2016-01-23 17:08:17 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2016-01-23 17:08:17 +0000 |
commit | 3c1c5bc607d7a7263fa2e06f9b2ee08cbb2100d6 (patch) | |
tree | 04764b343ccb6fa61389a749e43beb57fb1c1230 | |
parent | 13c803f30749c3612d98118aa9023e5b63087efc (diff) | |
download | FreeBSD-src-3c1c5bc607d7a7263fa2e06f9b2ee08cbb2100d6.zip FreeBSD-src-3c1c5bc607d7a7263fa2e06f9b2ee08cbb2100d6.tar.gz |
MFC 294366:
Initialize vm_page_prot to VM_MEMATTR_DEFAULT instead of 0.
If a driver's Linux mmap callback passed vm_page_prot through unchanged,
then linux_dev_mmap_single() would try to apply whatever VM_MEMATTR_xxx
value 0 is to the mapping. On x86, VM_MEMATTR_DEFAULT is the PAT value
for write-back (WB) which is 6, while 0 maps to the PAT value for
uncacheable (UC). Thus, any mmap request that did not explicitly set
page_prot was tried to map memory as UC triggering the warning in
sg_pager_getpages().
Sponsored by: Chelsio Communications
-rw-r--r-- | sys/ofed/include/linux/linux_compat.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/ofed/include/linux/linux_compat.c b/sys/ofed/include/linux/linux_compat.c index ef44c6d..92b6ac7 100644 --- a/sys/ofed/include/linux/linux_compat.c +++ b/sys/ofed/include/linux/linux_compat.c @@ -480,7 +480,7 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t *offset, vma.vm_end = size; vma.vm_pgoff = *offset / PAGE_SIZE; vma.vm_pfn = 0; - vma.vm_page_prot = 0; + vma.vm_page_prot = VM_MEMATTR_DEFAULT; if (filp->f_op->mmap) { error = -filp->f_op->mmap(filp, &vma); if (error == 0) { |