Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d73ae146 authored by Vineeth Vijayan's avatar Vineeth Vijayan Committed by Greg Kroah-Hartman
Browse files

s390/cio: check the subchannel validity for dev_busid



commit a4751f157c194431fae9e9c493f456df8272b871 upstream.

Check the validity of subchanel before reading other fields in
the schib.

Fixes: d3683c055212 ("s390/cio: add dev_busid sysfs entry for each subchannel")
CC: <stable@vger.kernel.org>
Reported-by: default avatarCornelia Huck <cohuck@redhat.com>
Signed-off-by: default avatarVineeth Vijayan <vneethv@linux.ibm.com>
Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
Link: https://lore.kernel.org/r/20211105154451.847288-1-vneethv@linux.ibm.com


Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1711b877
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -371,8 +371,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