Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2367468pxb; Mon, 20 Sep 2021 20:18:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJDnafzIqU0I6Mah42mosPC8oayYq09JeZGQbsvq4v3ic7+heAGsKnLLP4gEZjMPnBLMlj X-Received: by 2002:a5e:c70c:: with SMTP id f12mr21422367iop.166.1632194329873; Mon, 20 Sep 2021 20:18:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632194329; cv=none; d=google.com; s=arc-20160816; b=W//xNcdPSKb32N981q9L7PxZTE34Ev0pqp57wavUQIIox3sk0MMQ/ZXXB6osoekq6T p7DMVatJ8gILeBHHjHzn5D07AUk+HGjvhcSTP2U7jBiYEgWoztWvkzZRVJHfKfEwhML6 WxJZ21oEBLcCpjquCG6Nc3jEb1rl30TyJfw5V/WE63zvmSR1Teu7rgLiz8v1t4LOKZxp vSx8DgaWyj9BLYbU7tvbe42FwaMDZnwyGbIuG9rfHLXcG2gaaRlP9LEW3/aBTCOMt5mO WvrJ19H91GiFHOVq9vW3MOu4FbKYIDZLSkEnbGcScmH43fkmRxixc9Ngz9SOEfQ8Ayvo 4i5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VBErdU92E6VC+39DluoZ8lDM27CYNXG5Pwv8E/Se8b0=; b=q71DKz26TBZXtIQSUD9vTI6aCVYI29PuYOX8gP+FK65RXKuhya8YoEwpJrWCqkb9zu fTmDgD503PpgccGN4U91z5XjAethDKOo1yoaOadxcjxtQloqtf25+chVyvrGmK6kEmob S/Y80sjzAHZGRFwYmUVX/TwepxjqdPZ1W6BjEJNABvwz0II9yBeXJ0NV+0I3hUAcbB3g QnCWdGzDZvpmgAUTJecezNTfrBlEz5RB9ZfUgUzgMZNwfNCWc8U8grtIifcHNM5U09Nz fOiRK23acLu4vsqELuvEzcmMcDlER0khAw9+niWH0DeKpE1O0kQXzs+GIZ2h5P7bVr7y SO8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nHEMkoys; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c25si2716547ioz.73.2021.09.20.20.18.39; Mon, 20 Sep 2021 20:18:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nHEMkoys; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378303AbhITSYX (ORCPT + 99 others); Mon, 20 Sep 2021 14:24:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:39244 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351724AbhITSQ5 (ORCPT ); Mon, 20 Sep 2021 14:16:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E14F161A60; Mon, 20 Sep 2021 17:22:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158549; bh=rHM8pExSYGB04i59AgI0OSz9coKtLAGDTOw1Due3n4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nHEMkoysJiDkeAgs4FY59vM8UYoalB6pdQdLsLkK1fLMwEQPAKZoIvUiN4rde3BXz Zzkga6ABVHO546vO7SHo8tc+IZb/OJt2AFOZDww51qxLvyxcaxFx+HhHx+5sPjCZ7k NpampJp8KcO5vRffsxIEkqF0Acyu1PQv/bcniO7U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Egorenkov , Christian Borntraeger , Vasily Gorbik Subject: [PATCH 5.4 207/260] s390/sclp: fix Secure-IPL facility detection Date: Mon, 20 Sep 2021 18:43:45 +0200 Message-Id: <20210920163938.142246010@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163931.123590023@linuxfoundation.org> References: <20210920163931.123590023@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: Alexander Egorenkov commit d76b14f3971a0638b6cd0da289f8b48acee287d0 upstream. Prevent out-of-range access if the returned SCLP SCCB response is smaller in size than the address of the Secure-IPL flag. Fixes: c9896acc7851 ("s390/ipl: Provide has_secure sysfs attribute") Cc: stable@vger.kernel.org # 5.2+ Signed-off-by: Alexander Egorenkov Reviewed-by: Christian Borntraeger Signed-off-by: Vasily Gorbik Signed-off-by: Greg Kroah-Hartman --- drivers/s390/char/sclp_early.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/s390/char/sclp_early.c +++ b/drivers/s390/char/sclp_early.c @@ -40,13 +40,14 @@ static void __init sclp_early_facilities sclp.has_gisaf = !!(sccb->fac118 & 0x08); sclp.has_hvs = !!(sccb->fac119 & 0x80); sclp.has_kss = !!(sccb->fac98 & 0x01); - sclp.has_sipl = !!(sccb->cbl & 0x4000); if (sccb->fac85 & 0x02) S390_lowcore.machine_flags |= MACHINE_FLAG_ESOP; if (sccb->fac91 & 0x40) S390_lowcore.machine_flags |= MACHINE_FLAG_TLB_GUEST; if (sccb->cpuoff > 134) sclp.has_diag318 = !!(sccb->byte_134 & 0x80); + if (sccb->cpuoff > 137) + sclp.has_sipl = !!(sccb->cbl & 0x4000); sclp.rnmax = sccb->rnmax ? sccb->rnmax : sccb->rnmax2; sclp.rzm = sccb->rnsize ? sccb->rnsize : sccb->rnsize2; sclp.rzm <<= 20;