hvm_set_ioreq_page() releases wrong page in error path
authorPaul Durrant <paul.durrant@citrix.com>
Fri, 2 May 2014 09:46:32 +0000 (11:46 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 2 May 2014 09:46:32 +0000 (11:46 +0200)
The function calls prepare_ring_for_helper() to acquire a mapping for the
given gmfn, then checks (under lock) to see if the ioreq page is already
set up but, if it is, the function then releases the in-use ioreq page
mapping on the error path rather than the one it just acquired. This patch
fixes this bug.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/hvm/hvm.c

index ff6a1fd97d90eae05859863a68f43cbfb5c60e21..52903411836c1f3f30f635fb94aa000a7fa6b53c 100644 (file)
@@ -496,7 +496,7 @@ static int hvm_set_ioreq_page(
 
     if ( (iorp->va != NULL) || d->is_dying )
     {
-        destroy_ring_for_helper(&iorp->va, iorp->page);
+        destroy_ring_for_helper(&va, page);
         spin_unlock(&iorp->lock);
         return -EINVAL;
     }