diff options
author | Juergen Gross <jgross@suse.com> | 2022-05-24 13:46:30 +0200 |
---|---|---|
committer | Juergen Gross <jgross@suse.com> | 2022-05-27 11:05:29 +0200 |
commit | 49f8b459fc1de5e3712b57c8ccefae9ec45270f8 (patch) | |
tree | a94aa459860a3d82cae0933e922e1cbfaa980766 /drivers/xen/gntalloc.c | |
parent | 5b3353949e89d48b4faf54a9cc241ee5d70df615 (diff) | |
download | linux-stable-49f8b459fc1de5e3712b57c8ccefae9ec45270f8.tar.gz linux-stable-49f8b459fc1de5e3712b57c8ccefae9ec45270f8.tar.bz2 linux-stable-49f8b459fc1de5e3712b57c8ccefae9ec45270f8.zip |
xen: switch gnttab_end_foreign_access() to take a struct page pointer
Instead of a virtual kernel address use a pointer of the associated
struct page as second parameter of gnttab_end_foreign_access().
Most users have that pointer available already and are creating the
virtual address from it, risking problems in case the memory is
located in highmem.
gnttab_end_foreign_access() itself won't need to get the struct page
from the address again.
Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Diffstat (limited to 'drivers/xen/gntalloc.c')
-rw-r--r-- | drivers/xen/gntalloc.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/xen/gntalloc.c b/drivers/xen/gntalloc.c index 55acb32842a3..a15729beb9d1 100644 --- a/drivers/xen/gntalloc.c +++ b/drivers/xen/gntalloc.c @@ -175,8 +175,6 @@ undo: static void __del_gref(struct gntalloc_gref *gref) { - unsigned long addr; - if (gref->notify.flags & UNMAP_NOTIFY_CLEAR_BYTE) { uint8_t *tmp = kmap_local_page(gref->page); tmp[gref->notify.pgoff] = 0; @@ -190,10 +188,9 @@ static void __del_gref(struct gntalloc_gref *gref) gref->notify.flags = 0; if (gref->gref_id) { - if (gref->page) { - addr = (unsigned long)page_to_virt(gref->page); - gnttab_end_foreign_access(gref->gref_id, addr); - } else + if (gref->page) + gnttab_end_foreign_access(gref->gref_id, gref->page); + else gnttab_free_grant_reference(gref->gref_id); } |