Skip to content

Commit

Permalink
s390/cio: check the subchannel validity for dev_busid
Browse files Browse the repository at this point in the history
Check the validity of subchanel before reading other fields in
the schib.

Fixes: d3683c0 ("s390/cio: add dev_busid sysfs entry for each subchannel")
CC: <[email protected]>
Reported-by: Cornelia Huck <[email protected]>
Signed-off-by: Vineeth Vijayan <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Vasily Gorbik <[email protected]>
  • Loading branch information
vneethv authored and Vasily Gorbik committed Nov 8, 2021
1 parent 9d48c7a commit a4751f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/s390/cio/css.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,8 @@ static ssize_t dev_busid_show(struct device *dev,
struct subchannel *sch = to_subchannel(dev);
struct pmcw *pmcw = &sch->schib.pmcw;

if ((pmcw->st == SUBCHANNEL_TYPE_IO ||
pmcw->st == SUBCHANNEL_TYPE_MSG) && pmcw->dnv)
if ((pmcw->st == SUBCHANNEL_TYPE_IO && pmcw->dnv) ||
(pmcw->st == SUBCHANNEL_TYPE_MSG && pmcw->w))
return sysfs_emit(buf, "0.%x.%04x\n", sch->schid.ssid,
pmcw->dev);
else
Expand Down

0 comments on commit a4751f1

Please sign in to comment.