xen/24701-gnttab-map-grant-ref-recovery.patch

38 lines
1.4 KiB
Diff
Raw Normal View History

# HG changeset patch
# User Haoyu Zhang <haoyu.zhang@huawei.com>
# Date 1328563421 28800
# Node ID 3574f4d67843733ccaabab5f8ebb859c99d7314a
# Parent 5bd5830dea13f2a80a1b9728d3e61c34661fe764
Fix error recovery path in __gnttab_map_grant_ref
In file grant_table.c function __gnttab_map_grant_ref, if
__get_paged_frame failed, the effect of _set_status previously
called should be rollback, so the flag GTF_reading and _GTF_writing
will be recovered.
Signed-off-by: Haoyu Zhang <haoyu.zhang@huawei.com>
Signed-off-by: Liang Wang <hzwangliang.wang@huawei.com>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Keir Fraser <keir@xen.org>
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -566,7 +566,7 @@ __gnttab_map_grant_ref(
gfn = sha1 ? sha1->frame : sha2->full_page.frame;
rc = __get_paged_frame(gfn, &frame, !!(op->flags & GNTMAP_readonly), rd);
if ( rc != GNTST_okay )
- goto unlock_out;
+ goto unlock_out_clear;
act->gfn = gfn;
act->domid = ld->domain_id;
act->frame = frame;
@@ -722,6 +722,7 @@ __gnttab_map_grant_ref(
act->pin -= (op->flags & GNTMAP_readonly) ?
GNTPIN_hstr_inc : GNTPIN_hstw_inc;
+ unlock_out_clear:
if ( !(op->flags & GNTMAP_readonly) &&
!(act->pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) )
gnttab_clear_flag(_GTF_writing, status);