Skip to content

Commit 9293724

Browse files
committed
xen/gntdev: Do not use mm notifiers with autotranslating guests
Commit d3eeb1d ("xen/gntdev: use mmu_interval_notifier_insert") missed a test for use_ptemod when calling mmu_interval_read_begin(). Fix that. Fixes: d3eeb1d ("xen/gntdev: use mmu_interval_notifier_insert") CC: [email protected] # 5.5 Reported-by: Ilpo Järvinen <[email protected]> Tested-by: Ilpo Järvinen <[email protected]> Signed-off-by: Boris Ostrovsky <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Acked-by: Juergen Gross <[email protected]>
1 parent eda4eab commit 9293724

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

drivers/xen/gntdev.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,19 +1006,19 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
10061006
}
10071007
mutex_unlock(&priv->lock);
10081008

1009-
/*
1010-
* gntdev takes the address of the PTE in find_grant_ptes() and passes
1011-
* it to the hypervisor in gntdev_map_grant_pages(). The purpose of
1012-
* the notifier is to prevent the hypervisor pointer to the PTE from
1013-
* going stale.
1014-
*
1015-
* Since this vma's mappings can't be touched without the mmap_sem,
1016-
* and we are holding it now, there is no need for the notifier_range
1017-
* locking pattern.
1018-
*/
1019-
mmu_interval_read_begin(&map->notifier);
1020-
10211009
if (use_ptemod) {
1010+
/*
1011+
* gntdev takes the address of the PTE in find_grant_ptes() and
1012+
* passes it to the hypervisor in gntdev_map_grant_pages(). The
1013+
* purpose of the notifier is to prevent the hypervisor pointer
1014+
* to the PTE from going stale.
1015+
*
1016+
* Since this vma's mappings can't be touched without the
1017+
* mmap_sem, and we are holding it now, there is no need for
1018+
* the notifier_range locking pattern.
1019+
*/
1020+
mmu_interval_read_begin(&map->notifier);
1021+
10221022
map->pages_vm_start = vma->vm_start;
10231023
err = apply_to_page_range(vma->vm_mm, vma->vm_start,
10241024
vma->vm_end - vma->vm_start,

0 commit comments

Comments
 (0)