From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752448AbeA1UQI (ORCPT ); Sun, 28 Jan 2018 15:16:08 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:55511 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752145AbeA1UQF (ORCPT ); Sun, 28 Jan 2018 15:16:05 -0500 X-Google-Smtp-Source: AH8x226fH1BYR5Es2nbl1QVjYMQ+/GqdfPk+Drf1tV6/ryL6DEgBC1PLFczXZ4x0chJ1HYymFY1j6Q== Date: Sun, 28 Jan 2018 13:15:59 -0700 From: Jason Gunthorpe To: Tomas Winkler Cc: Jarkko Sakkinen , Alexander Usyskin , linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2 v2] tpm: cmd_ready command can be issued only after granting locality Message-ID: <20180128201559.GG23869@ziepe.ca> References: <20180128075101.6883-1-tomas.winkler@intel.com> <20180128075101.6883-2-tomas.winkler@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180128075101.6883-2-tomas.winkler@intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 28, 2018 at 09:51:00AM +0200, Tomas Winkler wrote: > diff --git a/include/linux/tpm.h b/include/linux/tpm.h > index bcdd3790e94d..06639fb6ab85 100644 > +++ b/include/linux/tpm.h > @@ -44,7 +44,7 @@ struct tpm_class_ops { > bool (*update_timeouts)(struct tpm_chip *chip, > unsigned long *timeout_cap); > int (*request_locality)(struct tpm_chip *chip, int loc); > - void (*relinquish_locality)(struct tpm_chip *chip, int loc); > + int (*relinquish_locality)(struct tpm_chip *chip, int loc); This seems wrong.. What is the core code supposed to do if relinquish fails? Just returning an error code from transmit doesn't really do anything helpful from a broad subsytem perspective. I think if a driver can fail reliquish then it needs some kind of strategy to recover. Suggest trying the reliquish again on every next request until success, otherwise fail request locality, potentially permanently. Jason