From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758785AbcH3SHM (ORCPT ); Tue, 30 Aug 2016 14:07:12 -0400 Received: from quartz.orcorp.ca ([184.70.90.242]:42579 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751158AbcH3SHJ (ORCPT ); Tue, 30 Aug 2016 14:07:09 -0400 Date: Tue, 30 Aug 2016 12:07:01 -0600 From: Jason Gunthorpe To: Jarkko Sakkinen Cc: Peter Huewe , stable@vger.kernel.org, Marcel Selhorst , "moderated list:TPM DEVICE DRIVER" , open list Subject: Re: [PATCH v6] tpm: fix a race condition in tpm2_unseal_trusted() Message-ID: <20160830180701.GA7586@obsidianresearch.com> References: <1472511066-20339-1-git-send-email-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1472511066-20339-1-git-send-email-jarkko.sakkinen@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.151 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 30, 2016 at 01:51:06AM +0300, Jarkko Sakkinen wrote: > Unseal and load operations should be done as an atomic operation. This > commit introduces unlocked tpm_transmit() so that tpm2_unseal_trusted() > can do the locking by itself. > > v2: Introduced an unlocked unseal operation instead of changing locking > strategy in order to make less intrusive bug fix and thus more > backportable. > > v3: Have also separate __tpm_transmit() that takes 'flags' in order to > better localize the bug fix and make it easier to backport. > > v4: Cleaned up the control flow in tpm2_unseal_trusted. Added the > missing 'Fixes' line. > > v5: Previous versions did not set the enum to any value, so it was set > to zero. Changed enum to TPM_TRANSMIT_UNLOCKED because it is > guaranteed to catch such situation. With change the common case > adds so little clutter that the wrappers do not make sense anymore. > > v6: Added flags parameter to internal TPM command wrappers to have > an expected default behavior and documented them. Yeah, this is nice. BTW, do not put the vX: stuff into the commit message, and it would be best to include it after the diffstat the patch email Reviewed-by: Jason Gunthorpe Jason From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from quartz.orcorp.ca ([184.70.90.242]:42579 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751158AbcH3SHJ (ORCPT ); Tue, 30 Aug 2016 14:07:09 -0400 Date: Tue, 30 Aug 2016 12:07:01 -0600 From: Jason Gunthorpe To: Jarkko Sakkinen Cc: Peter Huewe , stable@vger.kernel.org, Marcel Selhorst , "moderated list:TPM DEVICE DRIVER" , open list Subject: Re: [PATCH v6] tpm: fix a race condition in tpm2_unseal_trusted() Message-ID: <20160830180701.GA7586@obsidianresearch.com> References: <1472511066-20339-1-git-send-email-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1472511066-20339-1-git-send-email-jarkko.sakkinen@linux.intel.com> Sender: stable-owner@vger.kernel.org List-ID: On Tue, Aug 30, 2016 at 01:51:06AM +0300, Jarkko Sakkinen wrote: > Unseal and load operations should be done as an atomic operation. This > commit introduces unlocked tpm_transmit() so that tpm2_unseal_trusted() > can do the locking by itself. > > v2: Introduced an unlocked unseal operation instead of changing locking > strategy in order to make less intrusive bug fix and thus more > backportable. > > v3: Have also separate __tpm_transmit() that takes 'flags' in order to > better localize the bug fix and make it easier to backport. > > v4: Cleaned up the control flow in tpm2_unseal_trusted. Added the > missing 'Fixes' line. > > v5: Previous versions did not set the enum to any value, so it was set > to zero. Changed enum to TPM_TRANSMIT_UNLOCKED because it is > guaranteed to catch such situation. With change the common case > adds so little clutter that the wrappers do not make sense anymore. > > v6: Added flags parameter to internal TPM command wrappers to have > an expected default behavior and documented them. Yeah, this is nice. BTW, do not put the vX: stuff into the commit message, and it would be best to include it after the diffstat the patch email Reviewed-by: Jason Gunthorpe Jason