[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 5/6] xen/gnttab: Fold error handling in _cache_flush()



No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Julien Grall <julien@xxxxxxx>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
CC: Bertrand Marquis <bertrand.marquis@xxxxxxx>
CC: Michal Orzel <michal.orzel@xxxxxxx>
CC: Jan Beulich <jbeulich@xxxxxxxx>
CC: Roger Pau Monné <roger@xxxxxxxxxxxxxx>
CC: Teddy Astie <teddy.astie@xxxxxxxxxx>
CC: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
CC: Baptiste Le Duc <baptiste.le-duc@xxxxxxxxxx>
---
 xen/common/grant_table.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 4cc23f9231e6..d453c38556fc 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -3647,9 +3647,8 @@ static int _cache_flush(gnttab_cache_flush_t *cflush, 
grant_ref_t *cur_ref)
         act = grant_map_exists(d, owner->grant_table, mfn, cur_ref);
         if ( IS_ERR_OR_NULL(act) )
         {
-            grant_read_unlock(owner->grant_table);
-            put_page(page);
-            return act ? PTR_ERR(act) : 1;
+            ret = act ? PTR_ERR(act) : 1;
+            goto gnt_unlock;
         }
 
         /*
@@ -3683,13 +3682,15 @@ static int _cache_flush(gnttab_cache_flush_t *cflush, 
grant_ref_t *cur_ref)
     else
         ret = 0;
 
+    unmap_domain_page(v);
+
     if ( d != owner )
     {
         active_entry_release(act);
+    gnt_unlock:
         grant_read_unlock(owner->grant_table);
     }
 
-    unmap_domain_page(v);
     put_page(page);
 
     return ret;
-- 
2.39.5




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.