From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756008AbbCRQGR (ORCPT ); Wed, 18 Mar 2015 12:06:17 -0400 Received: from mx1.scotdoyle.com ([23.226.141.211]:47344 "EHLO mx1.scotdoyle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754535AbbCRQGQ (ORCPT ); Wed, 18 Mar 2015 12:06:16 -0400 Date: Wed, 18 Mar 2015 16:05:58 +0000 (GMT) From: Scot Doyle To: Jarkko Sakkinen cc: Peter Huewe , Marcel Selhorst , jason.gunthorpe@obsidianresearch.com, christophe.ricard@gmail.com, linux-kernel@vger.kernel.org, tpmdd-devel@lists.sourceforge.net Subject: Re: [tpmdd-devel] [PATCH v2] tpm: fix: sanitized code paths in tpm_chip_register() In-Reply-To: <1426659434-4003-1-git-send-email-jarkko.sakkinen@linux.intel.com> Message-ID: References: <1426659434-4003-1-git-send-email-jarkko.sakkinen@linux.intel.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 18 Mar 2015, Jarkko Sakkinen wrote: > I started to work with PPI interface so that it would be available > under character device sysfs directory and realized that chip > registeration was still too messy. > > In TPM 1.x in some rare scenarios (errors that almost never occur) > wrong order in deinitialization steps was taken in teardown. I > reproduced these scenarios by manually inserting error codes in the > place of the corresponding function calls. > > The key problem is that the teardown is messy with two separate code > paths (this was inherited when moving code from tpm-interface.c). > > Moved TPM 1.x specific register/unregister functionality to own helper > functions and added single code path for teardown in tpm_chip_register(). > Now the code paths have been fixed and it should be easier to review > later on this part of the code. > > Signed-off-by: Jarkko Sakkinen CONFIG_TCG_TPM=y CONFIG_TCG_TIS=y # CONFIG_TCG_TIS_I2C_ATMEL is not set # CONFIG_TCG_TIS_I2C_INFINEON is not set # CONFIG_TCG_TIS_I2C_NUVOTON is not set # CONFIG_TCG_NSC is not set # CONFIG_TCG_ATMEL is not set # CONFIG_TCG_INFINEON is not set # CONFIG_TCG_CRB is not set [0.236145] tpm_tis 00:08: 1.2 TPM (device-id 0xB, rev-id 16) [0.292769] tpm_tis 00:08: [Firmware Bug]: TPM interrupt not working, polling instead and suspend/resume continue to function. Tested-by: Scot Doyle