aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/cxl
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2017-11-10 20:55:03 +1100
committerMichael Ellerman <mpe@ellerman.id.au>2017-11-10 20:55:03 +1100
commita54c61f46e25345e99eec06a402f746fe33febc6 (patch)
tree23f59fe8702aaf90802cef6f25e76c15211747e1 /drivers/misc/cxl
parent77fad8bfb1d2f8225b05e4ea34457875fcfae37e (diff)
parent7ecb37f62fe58e3e4d9b03443b92d213b2c108ce (diff)
downloadlinux-a54c61f46e25345e99eec06a402f746fe33febc6.tar.gz
Merge branch 'fixes' into next
We have some dependencies & conflicts between patches in fixes and things to go in next, both in the radix TLB flush code and the IMC PMU driver. So merge fixes into next.
Diffstat (limited to 'drivers/misc/cxl')
-rw-r--r--drivers/misc/cxl/cxllib.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/misc/cxl/cxllib.c b/drivers/misc/cxl/cxllib.c
index 5dba23ca2e5fe9..dc9bc1807fdfa5 100644
--- a/drivers/misc/cxl/cxllib.c
+++ b/drivers/misc/cxl/cxllib.c
@@ -219,8 +219,17 @@ int cxllib_handle_fault(struct mm_struct *mm, u64 addr, u64 size, u64 flags)
down_read(&mm->mmap_sem);
- for (dar = addr; dar < addr + size; dar += page_size) {
- if (!vma || dar < vma->vm_start || dar > vma->vm_end) {
+ vma = find_vma(mm, addr);
+ if (!vma) {
+ pr_err("Can't find vma for addr %016llx\n", addr);
+ rc = -EFAULT;
+ goto out;
+ }
+ /* get the size of the pages allocated */
+ page_size = vma_kernel_pagesize(vma);
+
+ for (dar = (addr & ~(page_size - 1)); dar < (addr + size); dar += page_size) {
+ if (dar < vma->vm_start || dar >= vma->vm_end) {
vma = find_vma(mm, addr);
if (!vma) {
pr_err("Can't find vma for addr %016llx\n", addr);