Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2354151pxb; Mon, 20 Sep 2021 19:53:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeelAWM+waPi2vmOHDzgDFajEzhH+hWrJ1yrvrTYnw8Au9W2DYwDvTCKk8nR0diahmwvJN X-Received: by 2002:a17:906:eca7:: with SMTP id qh7mr32365784ejb.45.1632192796548; Mon, 20 Sep 2021 19:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192796; cv=none; d=google.com; s=arc-20160816; b=QPa6s9cTSFjntxg3ERNYGVJlcZeYYuPGkpnHbuhrY98ngN2XBwThoBu7/l+2vKJRVr VGJTi2XfeCTSeX5E9CgMH1M7BeUEBfy8/Ag9hn04oEfShVhWwP+3D+diBmAxCeI8O0XT tu4N3WkhwJao+UGFoL+B+EqDrScBzA5LY43RC4i17HqjAb0tmzwvVwJ/sbPDlZA4OsBu rOsdj1rT+iyEdr472ie5SmVE/on7tZXP7Vo9IY91pler44bOPuuHUiNvZ4Y7C5P9OeNd 41lZOQD9X5cfJWII7Xf61qHim/fWyMgCJdYXVOr5j1visKk1lqG+SVqgymjvjVQvLbpG elKg== 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=Q1Fy3g9hd7ZgIxb+5qMIjGxYR3uDad8k08++jjW4CYw=; b=K/VfqelcBb+dPGDwb7v56DFTD7zwR3KHJ30cItsIrlxs6RZMvaKgD2Nm1vuWjT7fVx F8ALpffzhomJTvLEsW1b9LQhqW5pQGq518u+I3goV3c0qbuUSYrFr/22MWCacNCgzLok QiGou3VLYLPTv+W3C1hWXIZTUVsTNtt0IqLInide6SdHtysrEGFD+DLDG7kQDOt1Eei8 5HIgT6LXIPLOAeBbKYq1TQgznlRJtGwb3MtnFZ6x5Jxp+Ta/FK3nnkKc9m4vgiMh8pDa 50UBZ0a3sIyvoCDEWJ4WPQFeO91zGxkuT1e6SGBABHEpwiCHl3YDHoHaY1DwyCI9Sqh6 2vNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=arY0dNl6; 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 a9si10351125edv.266.2021.09.20.19.52.53; Mon, 20 Sep 2021 19:53:16 -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=arY0dNl6; 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 S1383721AbhITSpk (ORCPT + 99 others); Mon, 20 Sep 2021 14:45:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:56462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382403AbhITSkY (ORCPT ); Mon, 20 Sep 2021 14:40:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5C14861AE0; Mon, 20 Sep 2021 17:31:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159074; bh=ZXTupcanNPL02RbJE4AXOwkFfCENNy8tbX6nbgftnxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=arY0dNl6fsZnRWLdLqsKAZYuE25s25YQDkb2AgeLYUZNyG/MoyvoX6RXnfug/hzvI 23o2wi6PL3iTYmDOhHgsoGBaJ+iAKOnef6AW+++Co5u8YOTlOUr7lfEuTHv/6wswaw r2EAE7U2tfS9qWyOCy7tYameMB2QU5GkBRIQxIUk= 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.14 032/168] s390/sclp: fix Secure-IPL facility detection Date: Mon, 20 Sep 2021 18:42:50 +0200 Message-Id: <20210920163922.702899887@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@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 @@ -45,13 +45,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;