x86/traps: loop in the correct direction in compat_iret()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 11 Jun 2015 12:44:47 +0000 (14:44 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 11 Jun 2015 12:44:47 +0000 (14:44 +0200)
This is CVE-2015-4164 / XSA-136.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/x86_64/compat/traps.c

index 4b6b9001cddd142ef13964d940af5f014c0dfad4..2dae0c7d8edaf797ecec1fbb6b354606807dc820 100644 (file)
@@ -119,7 +119,7 @@ unsigned int compat_iret(void)
         }
         else if ( ksp > regs->_esp )
         {
-            for (i = 9; i > 0; ++i)
+            for ( i = 9; i > 0; --i )
             {
                 rc |= __get_user(x, (u32 *)regs->rsp + i);
                 rc |= __put_user(x, (u32 *)(unsigned long)ksp + i);