From ffd14d57a42a3f6b0353c84ecf2fb106245e8af9 Mon Sep 17 00:00:00 2001 From: Haoyu Zhang Date: Wed, 7 Mar 2012 08:29:53 +0000 Subject: [PATCH] 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 Signed-off-by: Liang Wang Acked-by: Andres Lagar-Cavilla Committed-by: Keir Fraser xen-unstable changeset: 24701:3574f4d67843 xen-unstable date: Mon Feb 06 13:23:41 2012 -0800 --- xen/common/grant_table.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index f3b11a2c56..2b23072b07 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -567,7 +567,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,7 +722,8 @@ __gnttab_map_grant_ref( if ( op->flags & GNTMAP_host_map ) 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); -- 2.39.5