Commit 81339c5c authored by Peter Oberparleiter's avatar Peter Oberparleiter Committed by Ben Hutchings

s390/chsc: Add exception handler for CHSC instruction

commit 77759137 upstream.

Prevent kernel crashes due to unhandled exceptions raised by the CHSC
instruction which may for example be triggered by invalid ioctl data.

Fixes: 64150adf ("s390/cio: Introduce generic synchronous CHSC IOCTL")
Signed-off-by: default avatarPeter Oberparleiter <oberpar@linux.vnet.ibm.com>
Reviewed-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Reviewed-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 179d2405
...@@ -138,13 +138,15 @@ static inline int tpi(struct tpi_info *addr) ...@@ -138,13 +138,15 @@ static inline int tpi(struct tpi_info *addr)
static inline int chsc(void *chsc_area) static inline int chsc(void *chsc_area)
{ {
typedef struct { char _[4096]; } addr_type; typedef struct { char _[4096]; } addr_type;
int cc; int cc = -EIO;
asm volatile( asm volatile(
" .insn rre,0xb25f0000,%2,0\n" " .insn rre,0xb25f0000,%2,0\n"
" ipm %0\n" "0: ipm %0\n"
" srl %0,28\n" " srl %0,28\n"
: "=d" (cc), "=m" (*(addr_type *) chsc_area) "1:\n"
EX_TABLE(0b, 1b)
: "+d" (cc), "=m" (*(addr_type *) chsc_area)
: "d" (chsc_area), "m" (*(addr_type *) chsc_area) : "d" (chsc_area), "m" (*(addr_type *) chsc_area)
: "cc"); : "cc");
return cc; return cc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment