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

[Xen-changelog] [xen master] memory: exit early from memory_exchange() upon write-back error



commit 1cf4d2ec0d7c0cb53729ca810e416793030f6f07
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Apr 5 16:39:16 2017 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Apr 5 16:39:16 2017 +0200

    memory: exit early from memory_exchange() upon write-back error
    
    There's no point in continuing if in the end we'll return -EFAULT
    anyway. It also seems wrong to report a chunk for which at least one
    write-back failed as successfully exchanged (albeit the indication of
    an error is also not fully correct, as the exchange happened in that
    case at least partially - retrieving the GFN to assign the memory to
    and/or handing back the information on the replacement memory didn't
    work). In any case limiting the amount of damage done to the guest
    can't be all that bad an idea.
    
    Reported-by: Jann Horn <jannh@xxxxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Released-acked-by: Julien Grall <julien.grall@xxxxxxx>
---
 xen/common/memory.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 7dbddda..bed43e2 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -639,6 +639,9 @@ static long 
memory_exchange(XEN_GUEST_HANDLE_PARAM(xen_memory_exchange_t) arg)
             }
         }
         BUG_ON( !(d->is_dying) && (j != (1UL << out_chunk_order)) );
+
+        if ( rc )
+            goto fail;
     }
 
     exch.nr_exchanged = exch.in.nr_extents;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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