summaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2016-06-21 13:59:08 +0200
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2016-07-15 14:32:00 +0200
commitf9773768f10c6af77778df67d6050778de42f120 (patch)
treece9a7843a2fa0ae9238fd0cf88dbeb0858283ff1 /drivers/s390
parent0b601373778c770d7536b1d1761c3b2c06e4eb24 (diff)
downloadlinux-f9773768f10c6af77778df67d6050778de42f120.tar.bz2
s390/chsc: sanitize fmt check for chp_desc determination
When fetching channel path descriptors we've only evaluated the rfmt parameter which could lead us to trigger the chsc even though the machine doesn't support the specific format or to not trigger the chsc and report a failure to userspace even though the machine would've supported it. Improve these checks and change the parameters of the in-kernel user to be less confusing. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Reviewed-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/cio/chsc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index 39bb2ea7b78f..4fe9531fb128 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -907,7 +907,8 @@ int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt,
struct chsc_scpd *scpd_area;
int ccode, ret;
- if ((rfmt == 1) && !css_general_characteristics.fcs)
+ if ((rfmt == 1 || rfmt == 0) && c == 1 &&
+ !css_general_characteristics.fcs)
return -EINVAL;
if ((rfmt == 2) && !css_general_characteristics.cib)
return -EINVAL;
@@ -966,7 +967,7 @@ int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid,
spin_lock_irqsave(&chsc_page_lock, flags);
scpd_area = chsc_page;
- ret = chsc_determine_channel_path_desc(chpid, 0, 0, 1, 0, scpd_area);
+ ret = chsc_determine_channel_path_desc(chpid, 0, 1, 1, 0, scpd_area);
if (ret)
goto out;
chsc_resp = (void *)&scpd_area->response;