Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2351540pxb; Mon, 20 Sep 2021 19:47:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyaF6Urmirak8HVPBUmK22wdg2rV0dod1T3xQPI+4R6Jz+PepQs8FET+AVCp/17hQ/PnQp X-Received: by 2002:a05:6402:719:: with SMTP id w25mr32303571edx.94.1632192460726; Mon, 20 Sep 2021 19:47:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192460; cv=none; d=google.com; s=arc-20160816; b=vL1wxdZWCUx9h4xzJ3A9kByuTZWO0+tqAV/fOI3c3Xp7VshzNUGyzbUQ8lezeGt4NX dA9sy9mIULy0c5zazAcWg9at3pvuqJWzptXQEXUUMGmJ8hXpP8rw+9rxmvApySsV4zr1 AeLghTR3vrCX2hHd/c+fLaCEWPD+XUyqSeW5zAhK15JVLf77aCV5OSBQvUdUOXTfd7ES F2S96DZxhsPC7TA0AMOl1O6OOJxdeAfS1x5AltZzEYREGJES3TZplBjFpS247Z9K3Zx0 vjD/KZOavG5swnqzGx1oD4xVqdmcs8coa+JNYv5WXmNIgiovIOhnzg2HVVgY8y0Tm7nC zLvg== 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=kyMoGFRNdehJLidt3NjIkKKAnMQtXBQjIUCTf288UEZkedxjvu8OUWuSxvTtyhAusV CUWe4B2YoEZQDtk8XdCn39n/GU69rlEGvXIs12Mc0Iuz1h0tw6S1M7+xuJbCZ8d6VKbe XiN2Lu0g/am/wejEzcOkt4IuD0m5ROtM6Yzm2U1YMAaGBQ5JQLc/v88+9N2gtZjZ9A4+ NNMg3H0REp6/Vhe4xjlNgOUn0U9ObtF0Ve7k7YsBOadEn/GRHB3dqN32NUdJ9GiYnZRJ l8sPfTbLhMDnXQmwWRwXPjkM5vpbnIkJekog1BQzz0snqObrnJqt96VfE7rP7erPZFeY b4DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GfmfbN8s; 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 2si16640695ejh.749.2021.09.20.19.47.16; Mon, 20 Sep 2021 19:47:40 -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=GfmfbN8s; 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 S1379131AbhITSaY (ORCPT + 99 others); Mon, 20 Sep 2021 14:30:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:44478 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378348AbhITSY0 (ORCPT ); Mon, 20 Sep 2021 14:24:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B519C6140D; Mon, 20 Sep 2021 17:25:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158704; bh=rHM8pExSYGB04i59AgI0OSz9coKtLAGDTOw1Due3n4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GfmfbN8sOQ+bR42ijnkFAjMbyzSvDZuZJSdhKSnrDxaxoSVTtJcVb889n9ut2BmL1 fx/+TT+jMsNy9nq4WarG3UKS6pAfXIN/L0Bkc+D8gPZ537a1aNdSKsst5OnyGGSbyQ jQNUetLJp2Rlsa9CY7zJmkMSGcnsHpNGPjrA5xJE= 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.10 018/122] s390/sclp: fix Secure-IPL facility detection Date: Mon, 20 Sep 2021 18:43:10 +0200 Message-Id: <20210920163916.370908208@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163915.757887582@linuxfoundation.org> References: <20210920163915.757887582@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;