diff options
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/grant-table.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 1afd5690858c..9ef54ebc1194 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -455,6 +455,8 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, | |||
455 | unsigned long mfn; | 455 | unsigned long mfn; |
456 | 456 | ||
457 | ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, map_ops, count); | 457 | ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, map_ops, count); |
458 | if (ret) | ||
459 | return ret; | ||
458 | 460 | ||
459 | for (i = 0; i < count; i++) { | 461 | for (i = 0; i < count; i++) { |
460 | /* m2p override only supported for GNTMAP_contains_pte mappings */ | 462 | /* m2p override only supported for GNTMAP_contains_pte mappings */ |
@@ -463,7 +465,9 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, | |||
463 | pte = (pte_t *) (mfn_to_virt(PFN_DOWN(map_ops[i].host_addr)) + | 465 | pte = (pte_t *) (mfn_to_virt(PFN_DOWN(map_ops[i].host_addr)) + |
464 | (map_ops[i].host_addr & ~PAGE_MASK)); | 466 | (map_ops[i].host_addr & ~PAGE_MASK)); |
465 | mfn = pte_mfn(*pte); | 467 | mfn = pte_mfn(*pte); |
466 | m2p_add_override(mfn, pages[i]); | 468 | ret = m2p_add_override(mfn, pages[i]); |
469 | if (ret) | ||
470 | return ret; | ||
467 | } | 471 | } |
468 | 472 | ||
469 | return ret; | 473 | return ret; |
@@ -476,8 +480,14 @@ int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, | |||
476 | int i, ret; | 480 | int i, ret; |
477 | 481 | ||
478 | ret = HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, unmap_ops, count); | 482 | ret = HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, unmap_ops, count); |
479 | for (i = 0; i < count; i++) | 483 | if (ret) |
480 | m2p_remove_override(pages[i]); | 484 | return ret; |
485 | |||
486 | for (i = 0; i < count; i++) { | ||
487 | ret = m2p_remove_override(pages[i]); | ||
488 | if (ret) | ||
489 | return ret; | ||
490 | } | ||
481 | 491 | ||
482 | return ret; | 492 | return ret; |
483 | } | 493 | } |