Message ID | 20230607161647.3257117-1-stefanb@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp337319vqr; Wed, 7 Jun 2023 09:49:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ52kHLjMVAa86fkA9HxRugqm2fda/4Z5aVoywRxncxC6Saf3Uc93aH+pZzyLfKJu8/38OO5 X-Received: by 2002:a05:6a00:acd:b0:65b:6097:7961 with SMTP id c13-20020a056a000acd00b0065b60977961mr2784897pfl.17.1686156540824; Wed, 07 Jun 2023 09:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686156540; cv=none; d=google.com; s=arc-20160816; b=jxjI9aUbAjb8T+krn5jKMzMEooZ02qQpx6A/5qlezEYvMakuqdmLIiCAcMYdcIgJvS BT93XX+EB6qict5qsjbq/bFU3SO0dRAiN3H6L+inpYtfKtYiUUBIR6CUaQIU7WZfhvg2 Yv9wYftWN3x9p5iQ4mtMH9GzY7RM/mYHopwZGtBcQrJUbrlGVdtn5iyBaKTLg7jEDacN g3JFiUFqnwND1SgJtSxGHfVoytRDgsgzTdVqcF+wpn4MjORhv+jjE0hf+sxkRiiGSsNE Tn0dm9Ggn8zmu5CP2H9wUnSiO2SECIpz/A03rWqiNphSKCF97w25HtaS8hzfk64cSXfH A5Ug== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=YZNtjkkI9T51uNcuuhbSntzn8dpZVDQh6dU0E8G27dQ=; b=Z3E3j3+rpMK8Jn1a2CdUD02mvDtkm1dDFdKJLqkF9LOA5O0Vd74QXejbxLibzt7k2V s+VaacyPNktBshfL0xbGbRQxLv4UrkS64uibWe6jSdhaUGTpAfm47hEtQUkD8wxociEF 54LGDx4OibiXI64hpQWCOnW4tRHPm5x+g7lkUsBmqM+6Zzkjf5+NdG5/asAjC67m7uNH Uua/arNv+MaJCeJOJOMI1BVx4jZ4HffEqZYxbtg3onpffAb6rzjbroNyE2I/VfQsghoj idN4qIet8o3ZR+47UmKcnIwbosjV5tTzRkt1278T0k34vwIZNU5PRVXHW3xTmm5dGuv8 z7dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=CE14uwG5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t24-20020a63b258000000b00544059be66bsi1987173pgo.810.2023.06.07.09.48.48; Wed, 07 Jun 2023 09:49:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=CE14uwG5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231899AbjFGQRN (ORCPT <rfc822;literming00@gmail.com> + 99 others); Wed, 7 Jun 2023 12:17:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233845AbjFGQRG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 7 Jun 2023 12:17:06 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A0561702; Wed, 7 Jun 2023 09:17:00 -0700 (PDT) Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 357GA3pX009984; Wed, 7 Jun 2023 16:16:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=YZNtjkkI9T51uNcuuhbSntzn8dpZVDQh6dU0E8G27dQ=; b=CE14uwG5Ps5OFwQMmqGxpxamABQajge+q+jee3zu9bWt5OsKt03HmLY2W8o1ncOIR0z3 q+xRJU+YCaj1Ct0xUtuL16ZPY3/v2DG5Xf6VG3vJqnbZmw18+UM9Vc5m6x+eFyh9BGEt lZLm+YV22weH/po6Gj0FPc+KZek9hR3LHKMC89HiVuwSXOYjeHo20O7gtiU7u7ci7ZrV 5EJKLw2qY2Jmz7aosw4e4nnE8mQ3CUxZYTDgxVoB0St8WHjSUACgUel73KaKBbBKnKQn q2YylOeK0UFlv0GPAJBDquJSu9SlogKZPHty8gLyh2+rraiN+sPtduyyYWzWxzkYaTja xw== Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r2vub0tpm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 07 Jun 2023 16:16:55 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 357ER2ka008966; Wed, 7 Jun 2023 16:16:55 GMT Received: from smtprelay03.wdc07v.mail.ibm.com ([9.208.129.113]) by ppma01dal.us.ibm.com (PPS) with ESMTPS id 3r2a776utg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 07 Jun 2023 16:16:55 +0000 Received: from smtpav01.dal12v.mail.ibm.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay03.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 357GGrwi2163248 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 7 Jun 2023 16:16:53 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 65E8A58058; Wed, 7 Jun 2023 16:16:53 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1561D58057; Wed, 7 Jun 2023 16:16:53 +0000 (GMT) Received: from sbct-2.pok.ibm.com (unknown [9.47.158.152]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 7 Jun 2023 16:16:52 +0000 (GMT) From: Stefan Berger <stefanb@linux.ibm.com> To: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, jarkko@kernel.org Cc: Stefan Berger <stefanb@linux.ibm.com> Subject: [PATCH] tpm: Check for availability of chip->ops before requesting locality Date: Wed, 7 Jun 2023 12:16:47 -0400 Message-Id: <20230607161647.3257117-1-stefanb@linux.ibm.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Y4TG5f6hfxaRpR5DOFOqZaz_Iugeg7wk X-Proofpoint-ORIG-GUID: Y4TG5f6hfxaRpR5DOFOqZaz_Iugeg7wk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-07_07,2023-06-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 spamscore=0 malwarescore=0 phishscore=0 suspectscore=0 mlxlogscore=882 impostorscore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306070137 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768063281006485493?= X-GMAIL-MSGID: =?utf-8?q?1768063281006485493?= |
Series |
tpm: Check for availability of chip->ops before requesting locality
|
|
Commit Message
Stefan Berger
June 7, 2023, 4:16 p.m. UTC
When executing kexec on ppc64 tpm_class_shutdown() is called before
tpm_chip_unregister() and therefore chip->ops is NULL when
tpm_amd_is_rng_defective() is called. Check for chip->ops before
requesting the locality in tpm_amd_is_rng_defective() to avoid a
crash.
Fixes: bd8621ca1510 ("tpm: Add !tpm_amd_is_rng_defective() to the hwrng_unregister() call site")
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
drivers/char/tpm/tpm-chip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index cd48033b804a..bc1ec1632fd8 100644 --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c @@ -524,7 +524,7 @@ static bool tpm_amd_is_rng_defective(struct tpm_chip *chip) u64 version; int ret; - if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) + if (!chip->ops || !(chip->flags & TPM_CHIP_FLAG_TPM2)) return false; ret = tpm_request_locality(chip);