Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 024F2C433F5 for ; Wed, 24 Nov 2021 12:43:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343815AbhKXMq7 (ORCPT ); Wed, 24 Nov 2021 07:46:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:50508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345715AbhKXMoD (ORCPT ); Wed, 24 Nov 2021 07:44:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7E5696124D; Wed, 24 Nov 2021 12:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637756761; bh=gFkHNSAYPKPl1wN+NS84UXxXrBHMmrC26H9QTnQrHF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LIyj6f5luIcnCgJqIYm2abnfiIUVCvM/T4NPz3hjnlHTF6kGlkyLqqseRnKf5EVZO d7vSg7mc+7wCAQR5vlXwEYjPmNuYgqzGm5lqI46ruH9NqznT5imqP0PRqyOMGWP12K 0C0kIqaZuyftmUS6yDYbJRpnGbYz/HkfDhEbM3AI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cornelia Huck , Vineeth Vijayan , Vasily Gorbik Subject: [PATCH 4.14 196/251] s390/cio: check the subchannel validity for dev_busid Date: Wed, 24 Nov 2021 12:57:18 +0100 Message-Id: <20211124115717.084019018@linuxfoundation.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211124115710.214900256@linuxfoundation.org> References: <20211124115710.214900256@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vineeth Vijayan 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: Reported-by: Cornelia Huck Signed-off-by: Vineeth Vijayan Reviewed-by: Cornelia Huck Link: https://lore.kernel.org/r/20211105154451.847288-1-vneethv@linux.ibm.com Signed-off-by: Vasily Gorbik Signed-off-by: Greg Kroah-Hartman --- drivers/s390/cio/css.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c @@ -337,8 +337,8 @@ static ssize_t dev_busid_show(struct 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