From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50C61C04A6A for ; Thu, 3 Aug 2023 13:52:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233850AbjHCNwB (ORCPT ); Thu, 3 Aug 2023 09:52:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234168AbjHCNv7 (ORCPT ); Thu, 3 Aug 2023 09:51:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83CB413D; Thu, 3 Aug 2023 06:51:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 13DD861D85; Thu, 3 Aug 2023 13:51:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E23AC433C8; Thu, 3 Aug 2023 13:51:55 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="Vj6oUffI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1691070713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=S5JwOoI+ZFbwXVeHhEPuM+BAtu3rUbpaUamON1nqc30=; b=Vj6oUffIrhn9fItDtdT/uTzNB0DS8JCpm0SQqquzdU9M0gpCW8XUILr1lr3sfe57FB07SB tgzS/zJGxcLRO5xACcWNsagXlzbJKVkbj/mfhkPEt9acO/+s9sI8Hiv708wLLhA2T67UaY d38AgQgGfILCKdjRuVSIiObA86ixNL0= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id c59b81e9 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 3 Aug 2023 13:51:53 +0000 (UTC) Date: Thu, 3 Aug 2023 15:50:44 +0200 From: "Jason A. Donenfeld" To: Mario Limonciello Cc: Jarkko Sakkinen , peterhuewe@gmx.de, linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, dragonn@op.pl Subject: Re: [PATCH 1/3] tpm: Add a missing check for TPM_CHIP_FLAG_HWRNG_DISABLED Message-ID: References: <20230803015015.915-1-mario.limonciello@amd.com> <20230803015015.915-2-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On Thu, Aug 03, 2023 at 06:35:36AM -0500, Mario Limonciello wrote: > On 8/3/23 03:59, Jarkko Sakkinen wrote: > > On Thu Aug 3, 2023 at 4:50 AM EEST, Mario Limonciello wrote: > >> If the TPM is opted out of hwrng the error handling for > >> tpm_chip_register() needs to know this so it doesn't try to clean > >> up an uninitialized chip->hwrng. > >> > >> Signed-off-by: Mario Limonciello > >> --- > >> drivers/char/tpm/tpm-chip.c | 3 ++- > >> 1 file changed, 2 insertions(+), 1 deletion(-) > >> > >> diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c > >> index e904aae9771be..8f61b784810d6 100644 > >> --- a/drivers/char/tpm/tpm-chip.c > >> +++ b/drivers/char/tpm/tpm-chip.c > >> @@ -629,7 +629,8 @@ int tpm_chip_register(struct tpm_chip *chip) > >> return 0; > >> > >> out_hwrng: > >> - if (IS_ENABLED(CONFIG_HW_RANDOM_TPM) && !tpm_is_firmware_upgrade(chip)) > >> + if (IS_ENABLED(CONFIG_HW_RANDOM_TPM) && !tpm_is_firmware_upgrade(chip) && > >> + !(chip->flags & TPM_CHIP_FLAG_HWRNG_DISABLED)) > >> hwrng_unregister(&chip->hwrng); > >> out_ppi: > >> tpm_bios_log_teardown(chip); > >> -- > >> 2.34.1 > > > > Please add a fixes tag. > > > > BR, Jarkko > > I didn't add a fixes tag because you hadn't sent a PR for the other one > yet so I wasn't sure the hash would be stable. Also I thought it might > just make sense to squash into it. > > If the hash is now stable, could you just just commit and add that tag > with it yourself? Or do you want me to re-send as a v2 with that? What about just sending a v3 of the patch that this patch fixes? The stable@/fixes tags in that are wrong/incomplete so Jarkko's tree will need to be fixed before pushing to Linus anyway. Jason