diff options
author | Peter Oberparleiter <oberpar@linux.vnet.ibm.com> | 2017-02-20 08:52:58 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2017-02-23 04:06:38 -0500 |
commit | 77759137248f34864a8f7a58bbcebfcf1047504a (patch) | |
tree | fd5022c36a6d18ee5fa437c1e4cddb4c309f7683 | |
parent | f50c0e6371c960ad3481daa4504b33a9de4e9d01 (diff) |
s390/chsc: Add exception handler for CHSC instruction
Prevent kernel crashes due to unhandled exceptions raised by the CHSC
instruction which may for example be triggered by invalid ioctl data.
Fixes: 64150adf89df ("s390/cio: Introduce generic synchronous CHSC IOCTL")
Cc: <stable@vger.kernel.org> # v3.11+
Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Reviewed-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | drivers/s390/cio/ioasm.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/s390/cio/ioasm.c b/drivers/s390/cio/ioasm.c index 8225da619014..4182f60124da 100644 --- a/drivers/s390/cio/ioasm.c +++ b/drivers/s390/cio/ioasm.c | |||
@@ -165,13 +165,15 @@ int tpi(struct tpi_info *addr) | |||
165 | int chsc(void *chsc_area) | 165 | int chsc(void *chsc_area) |
166 | { | 166 | { |
167 | typedef struct { char _[4096]; } addr_type; | 167 | typedef struct { char _[4096]; } addr_type; |
168 | int cc; | 168 | int cc = -EIO; |
169 | 169 | ||
170 | asm volatile( | 170 | asm volatile( |
171 | " .insn rre,0xb25f0000,%2,0\n" | 171 | " .insn rre,0xb25f0000,%2,0\n" |
172 | " ipm %0\n" | 172 | "0: ipm %0\n" |
173 | " srl %0,28\n" | 173 | " srl %0,28\n" |
174 | : "=d" (cc), "=m" (*(addr_type *) chsc_area) | 174 | "1:\n" |
175 | EX_TABLE(0b, 1b) | ||
176 | : "+d" (cc), "=m" (*(addr_type *) chsc_area) | ||
175 | : "d" (chsc_area), "m" (*(addr_type *) chsc_area) | 177 | : "d" (chsc_area), "m" (*(addr_type *) chsc_area) |
176 | : "cc"); | 178 | : "cc"); |
177 | trace_s390_cio_chsc(chsc_area, cc); | 179 | trace_s390_cio_chsc(chsc_area, cc); |