Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1838295pxb; Mon, 13 Sep 2021 06:39:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2QNlblJqivl2+jlVD7ZCRUqMPyNcGHk9/qZmMAyGzrcAUl8nQTizBO3kJHJdHC9Ga3JaW X-Received: by 2002:a02:ab87:: with SMTP id t7mr9794713jan.127.1631540398193; Mon, 13 Sep 2021 06:39:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631540398; cv=none; d=google.com; s=arc-20160816; b=EWej+//O+Byen/9NlrmChvE/gb5rQtHOzHdCnt0rYk4jLynZDoZFEURAVO3yjQpHpv Wf4V+QF3rx+tiAo9dIbHI5AehzbbVELHXKH4+tPlNFq1JuxCZsQD4SK+/a5XVJEI0yum vyKYrop7TngGLeOMq76B2s8tUkRM3cn9SwA0hx/JN/ixx5KmJaQEOJRNiCL2gM5o9oPQ 99lk7Ep04m+8f5qaWhVlKILGZvnZ+S9sw+SRhd/1QUpT/mGxfevqC1CmHE8QckLgOMbm 58ecCBN5xXNKYAKyPyIJNVMPVgSulgRFP3m1D6mbQjH2mqtO3w/v3/TxRgUpDSVaTeN2 9rDQ== 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=EzTABZQ+2njpSGFAP0Z3acnMnm1s1nMTzWOLfe/KOkA=; b=JE3TxPyLhA3PsdKNx208temMK0dtCYKJ+Q1Tu/6fn3G/+Ch9afmigNFgKwO4AQJzMM YFs4skrH/h5gUvi5pAslDQ/Z+jlno/pQ9ezIJsUJttD8dzPv5et9IFqH3roxCTlibkuq ZWuVleFDfN+A8fNkYROBkCM77m+Kz1XxvTsas043dmsPUdVicUbiQOuW68ue9txYEogK syWdGT7IrsIaAXoTvK4Hhvmc2NaTSKbWCR88iai+54ZVnGNWEAGRL7Exy2ZfxyY+cYZz g7LcdEeTblG0ZXOuDymvbKNr8wP/cBlELprmLueH3olKKOPUehxz0eLVqq5mKuvh0nCp qGbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XtHRWMjo; 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 i9si6393699ilc.6.2021.09.13.06.39.44; Mon, 13 Sep 2021 06:39:58 -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=XtHRWMjo; 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 S243398AbhIMNj3 (ORCPT + 99 others); Mon, 13 Sep 2021 09:39:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:46802 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242427AbhIMN3Y (ORCPT ); Mon, 13 Sep 2021 09:29:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B21BC6124D; Mon, 13 Sep 2021 13:23:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539440; bh=Cz1d3nehDoogkLHm8LYFCfX8k+Pf330baoN+ih7Qsh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XtHRWMjoWs/EVSSO/tB6/n4PG13Cr8TCmBYYYoGwoVyaY1N4soyv1zemy1Nu13lTY BAN+dCpfcMV30CH7ln3pkudKgFdACVEVPGh9npZHsbfL/OwjByZ2E5WSoqF+mPCQfU ecwjRjEbL6bImY4hLWY2xj13z9yDEGbCIe+dGeps= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harald Freudenberger , Vasily Gorbik , Sasha Levin Subject: [PATCH 5.10 025/236] s390/zcrypt: fix wrong offset index for APKA master key valid state Date: Mon, 13 Sep 2021 15:12:10 +0200 Message-Id: <20210913131101.207592666@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@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: Harald Freudenberger [ Upstream commit 8617bb74006252cb2286008afe7d6575a6425857 ] Tests showed a mismatch between what the CCA tool reports about the APKA master key state and what's displayed by the zcrypt dd in sysfs. After some investigation, we found out that the documentation which was the source for the zcrypt dd implementation lacks the listing of 3 fields. So this patch now moves the evaluation of the APKA master key state to the correct offset. Signed-off-by: Harald Freudenberger Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin --- drivers/s390/crypto/zcrypt_ccamisc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/s390/crypto/zcrypt_ccamisc.c b/drivers/s390/crypto/zcrypt_ccamisc.c index b1046811450f..ffab935ddd95 100644 --- a/drivers/s390/crypto/zcrypt_ccamisc.c +++ b/drivers/s390/crypto/zcrypt_ccamisc.c @@ -1715,10 +1715,10 @@ static int fetch_cca_info(u16 cardnr, u16 domain, struct cca_info *ci) rlen = vlen = PAGE_SIZE/2; rc = cca_query_crypto_facility(cardnr, domain, "STATICSB", rarray, &rlen, varray, &vlen); - if (rc == 0 && rlen >= 10*8 && vlen >= 240) { - ci->new_apka_mk_state = (char) rarray[7*8]; - ci->cur_apka_mk_state = (char) rarray[8*8]; - ci->old_apka_mk_state = (char) rarray[9*8]; + if (rc == 0 && rlen >= 13*8 && vlen >= 240) { + ci->new_apka_mk_state = (char) rarray[10*8]; + ci->cur_apka_mk_state = (char) rarray[11*8]; + ci->old_apka_mk_state = (char) rarray[12*8]; if (ci->old_apka_mk_state == '2') memcpy(&ci->old_apka_mkvp, varray + 208, 8); if (ci->cur_apka_mk_state == '2') -- 2.30.2