aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2017-02-21 04:51:55 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2017-02-23 04:06:39 -0500
commit70e28aa0bbb68ed458be0b922d8b58a2b4ae191d (patch)
tree8bb862b3a6be633354fcc44e18d5b14b9507ea2b
parent776067080ca070ef38d33a16faedc28a2f413ee7 (diff)
s390/nmi: fix order of register validation
When validating register contents first validate control registers since these control the availability of features later being validated. For example the control register 0 should be validated first, before the additional floating point (AFP) registers are validated, since control register 0 contains the AFP-register control bit. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/kernel/nmi.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c
index 56e14d073167..b76b5fef251e 100644
--- a/arch/s390/kernel/nmi.c
+++ b/arch/s390/kernel/nmi.c
@@ -116,6 +116,18 @@ static int notrace s390_validate_registers(union mci mci, int umode)
116 s390_handle_damage(); 116 s390_handle_damage();
117 kill_task = 1; 117 kill_task = 1;
118 } 118 }
119 /* Validate control registers */
120 if (!mci.cr) {
121 /*
122 * Control registers have unknown contents.
123 * Can't recover and therefore stopping machine.
124 */
125 s390_handle_damage();
126 } else {
127 asm volatile(
128 " lctlg 0,15,0(%0)"
129 : : "a" (&S390_lowcore.cregs_save_area) : "memory");
130 }
119 if (!mci.fp) { 131 if (!mci.fp) {
120 /* 132 /*
121 * Floating point registers can't be restored. If the 133 * Floating point registers can't be restored. If the
@@ -208,18 +220,6 @@ static int notrace s390_validate_registers(union mci mci, int umode)
208 */ 220 */
209 kill_task = 1; 221 kill_task = 1;
210 } 222 }
211 /* Validate control registers */
212 if (!mci.cr) {
213 /*
214 * Control registers have unknown contents.
215 * Can't recover and therefore stopping machine.
216 */
217 s390_handle_damage();
218 } else {
219 asm volatile(
220 " lctlg 0,15,0(%0)"
221 : : "a" (&S390_lowcore.cregs_save_area) : "memory");
222 }
223 /* 223 /*
224 * We don't even try to validate the TOD register, since we simply 224 * We don't even try to validate the TOD register, since we simply
225 * can't write something sensible into that register. 225 * can't write something sensible into that register.