x86: fix access.flat on non-SMEP machines

We need to restore PDPE.U=1, similar to what the tests do after printing
the "Set SMEP in CR4 - expect #GP: FAIL" message.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1505510552-22114-1-git-send-email-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/x86/access.c b/x86/access.c
index a0c19dc..11f561b 100644
--- a/x86/access.c
+++ b/x86/access.c
@@ -207,7 +207,7 @@
     if (smep)
         ptl2[2] &= ~PT_USER_MASK;
     r = write_cr4_checking(cr4);
-    if (!smep)
+    if (r || !smep)
         ptl2[2] |= PT_USER_MASK;
     return r;
 }