aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2012-09-12 07:44:30 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2012-09-12 11:21:40 -0400
commit2fc136eecd0c647a6b13fcd00d0c41a1a28f35a5 (patch)
tree2a43ce841b2bedf8206609b6c43321e540540c35 /drivers/xen
parent80ba77dfbce85f2d1be54847de3c866de1b18a9a (diff)
xen/m2p: do not reuse kmap_op->dev_bus_addr
If the caller passes a valid kmap_op to m2p_add_override, we use kmap_op->dev_bus_addr to store the original mfn, but dev_bus_addr is part of the interface with Xen and if we are batching the hypercalls it might not have been written by the hypervisor yet. That means that later on Xen will write to it and we'll think that the original mfn is actually what Xen has written to it. Rather than "stealing" struct members from kmap_op, keep using page->index to store the original mfn and add another parameter to m2p_remove_override to get the corresponding kmap_op instead. It is now responsibility of the caller to keep track of which kmap_op corresponds to a particular page in the m2p_override (gntdev, the only user of this interface that passes a valid kmap_op, is already doing that). CC: stable@kernel.org Reported-and-Tested-By: Sander Eikelenboom <linux@eikelenboom.it> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/xen')
-rw-r--r--drivers/xen/gntdev.c5
-rw-r--r--drivers/xen/grant-table.c6
2 files changed, 7 insertions, 4 deletions
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index 1ffd03bf8e1..7f124160848 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -314,8 +314,9 @@ static int __unmap_grant_pages(struct grant_map *map, int offset, int pages)
314 } 314 }
315 } 315 }
316 316
317 err = gnttab_unmap_refs(map->unmap_ops + offset, map->pages + offset, 317 err = gnttab_unmap_refs(map->unmap_ops + offset,
318 pages, true); 318 use_ptemod ? map->kmap_ops + offset : NULL, map->pages + offset,
319 pages);
319 if (err) 320 if (err)
320 return err; 321 return err;
321 322
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 0bfc1ef1125..006726688ba 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -870,7 +870,8 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
870EXPORT_SYMBOL_GPL(gnttab_map_refs); 870EXPORT_SYMBOL_GPL(gnttab_map_refs);
871 871
872int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, 872int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
873 struct page **pages, unsigned int count, bool clear_pte) 873 struct gnttab_map_grant_ref *kmap_ops,
874 struct page **pages, unsigned int count)
874{ 875{
875 int i, ret; 876 int i, ret;
876 bool lazy = false; 877 bool lazy = false;
@@ -888,7 +889,8 @@ int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
888 } 889 }
889 890
890 for (i = 0; i < count; i++) { 891 for (i = 0; i < count; i++) {
891 ret = m2p_remove_override(pages[i], clear_pte); 892 ret = m2p_remove_override(pages[i], kmap_ops ?
893 &kmap_ops[i] : NULL);
892 if (ret) 894 if (ret)
893 return ret; 895 return ret;
894 } 896 }