]> git.itanic.dy.fi Git - linux-stable/commitdiff
s390/cio: check the subchannel validity for dev_busid
authorVineeth Vijayan <vneethv@linux.ibm.com>
Fri, 5 Nov 2021 15:44:51 +0000 (16:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Nov 2021 10:40:37 +0000 (11:40 +0100)
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: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Link: https://lore.kernel.org/r/20211105154451.847288-1-vneethv@linux.ibm.com
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/s390/cio/css.c

index 435e804b6b8b115aee275982c3fc1e550cd39c60..cf00baa3142f4807eb0ea8a3c684c1ec4158ce86 100644 (file)
@@ -337,8 +337,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