xen/gntdev: remove erronous use of copy_to_user
Since there is now a mapping of granted pages in kernel address space in both PV and HVM, use it for UNMAP_NOTIFY_CLEAR_BYTE instead of accessing memory via copy_to_user and triggering sleep-in-atomic warnings. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
This commit is contained in:
parent
16a1d0225e
commit
1affa98d23
|
@ -312,17 +312,10 @@ static int __unmap_grant_pages(struct grant_map *map, int offset, int pages)
|
||||||
|
|
||||||
if (map->notify.flags & UNMAP_NOTIFY_CLEAR_BYTE) {
|
if (map->notify.flags & UNMAP_NOTIFY_CLEAR_BYTE) {
|
||||||
int pgno = (map->notify.addr >> PAGE_SHIFT);
|
int pgno = (map->notify.addr >> PAGE_SHIFT);
|
||||||
if (pgno >= offset && pgno < offset + pages && use_ptemod) {
|
if (pgno >= offset && pgno < offset + pages) {
|
||||||
void __user *tmp = (void __user *)
|
/* No need for kmap, pages are in lowmem */
|
||||||
map->vma->vm_start + map->notify.addr;
|
uint8_t *tmp = pfn_to_kaddr(page_to_pfn(map->pages[pgno]));
|
||||||
err = copy_to_user(tmp, &err, 1);
|
|
||||||
if (err)
|
|
||||||
return -EFAULT;
|
|
||||||
map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE;
|
|
||||||
} else if (pgno >= offset && pgno < offset + pages) {
|
|
||||||
uint8_t *tmp = kmap(map->pages[pgno]);
|
|
||||||
tmp[map->notify.addr & (PAGE_SIZE-1)] = 0;
|
tmp[map->notify.addr & (PAGE_SIZE-1)] = 0;
|
||||||
kunmap(map->pages[pgno]);
|
|
||||||
map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE;
|
map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue