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

[xen master] viridian: don't blindly write to 32-bit registers if 'mode' is invalid



commit 7c8946dae39b544094d969ef902d49e8ea0ea973
Author:     Paul Durrant <pdurrant@xxxxxxxxxx>
AuthorDate: Fri Dec 4 13:12:54 2020 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Dec 4 13:12:54 2020 +0100

    viridian: don't blindly write to 32-bit registers if 'mode' is invalid
    
    If hvm_guest_x86_mode() returns something other than 8 or 4 then
    viridian_hypercall() will return immediately but, on the way out, will write
    back status as if 'mode' was 4. This patch simply makes it leave the 
registers
    alone.
    
    NOTE: The formatting of the 'out' label and the switch statement are also
          adjusted as per CODING_STYLE.
    
    Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>
    Acked-by: Wei Liu <wl@xxxxxxx>
---
 xen/arch/x86/hvm/viridian/viridian.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/viridian/viridian.c 
b/xen/arch/x86/hvm/viridian/viridian.c
index dc7183a546..3dbb5c2d4c 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -692,13 +692,15 @@ int viridian_hypercall(struct cpu_user_regs *regs)
         break;
     }
 
-out:
+ out:
     output.result = status;
-    switch (mode) {
+    switch ( mode )
+    {
     case 8:
         regs->rax = output.raw;
         break;
-    default:
+
+    case 4:
         regs->rdx = output.raw >> 32;
         regs->rax = (uint32_t)output.raw;
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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