Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3754003imm; Mon, 15 Oct 2018 03:42:38 -0700 (PDT) X-Google-Smtp-Source: ACcGV61yhJpZepnrdxCCLTsk2ZEhWXFfbm37yAbXpEWAE349nfSGcqIWQLaZITZHb4B55pqH96Dc X-Received: by 2002:a62:1b45:: with SMTP id b66-v6mr17074057pfb.94.1539600158076; Mon, 15 Oct 2018 03:42:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539600158; cv=none; d=google.com; s=arc-20160816; b=zIjGHnLIdrq+i8AalliM5Ej+9Yt7N5P5xW/vUKhKQ/2EU+mhVHdRbSjV0XlqqXFLCv /NOhR0V8u2vZsG2hfK0AbnL2nBpafWGhgCtCnpjo0E7P8h1QO9wweSYxh7b6V6pCmpWh 6pihFgM/KHBuyWpF8PuoJxRTkY+11phN3uQLYXNJ1Nxe1KjimkKa9+QCaIBkDItxHYYo K29r3HJWyBcOIeO8h4YQaHSb6EnZgWAyrlwSFQxkRHGqOAVGBBeEUzn4YfntGx21MaA2 dm4mQZ1JG6vL6L8FudawUwWxwrw/GpIa44I1BUMU81n4kXIp+38X+7EY8aJchTBKnkJ3 AB5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=WUvi26PH0tPr6dKZrrqGks0Vre6TdMRaA9ALivgviG0=; b=TfBdgxbH1bcQgLo0bTZWIRwFo0r91emWoCz27q9IiKZBZwz31AYmW4qzv8IreByLk5 pNFCiIolZbGKuDU1SLOufNPlf83uF7NtcMpPioT2uTfVoA5+Tz1VFMs4AZFOFvjdMl83 RxpWR8UYzg75VbrzyZhyGCoa0gKVnse9ihJhrYnJLb13ALEGP5A2mY7PM3UbSu4ZuQxv 68HORdekGPWe1zvJKkjrlcth9YGiiouMo1cGaAj4/lVvZdroZOSCkDD/ryyeax7TJjkR jKrnn19ZnH3d969imZ3XxW73Og9mWdTk5TcwLdusuC0TZYqT4a5Or+Vxn50tN9r5yL7J /z9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t82-v6si9895250pgb.505.2018.10.15.03.42.22; Mon, 15 Oct 2018 03:42:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726553AbeJOS0m (ORCPT + 99 others); Mon, 15 Oct 2018 14:26:42 -0400 Received: from mga09.intel.com ([134.134.136.24]:28519 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726273AbeJOS0m (ORCPT ); Mon, 15 Oct 2018 14:26:42 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Oct 2018 03:42:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,384,1534834800"; d="scan'208";a="88441574" Received: from jsakkine-mobl1.tm.intel.com (HELO localhost) ([10.237.50.171]) by FMSMGA003.fm.intel.com with ESMTP; 15 Oct 2018 03:41:57 -0700 Date: Mon, 15 Oct 2018 13:41:56 +0300 From: Jarkko Sakkinen To: "Winkler, Tomas" Cc: Jason Gunthorpe , "Gustavo A. R. Silva" , Peter Huewe , Arnd Bergmann , Greg Kroah-Hartman , "linux-integrity@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] tpm: fix unused-value issues in tpm_try_transmit Message-ID: <20181015104156.GA13408@linux.intel.com> References: <20181010133817.GA11485@embeddedor.com> <20181010140638.GA3894@ziepe.ca> <20181011120140.GA15767@linux.intel.com> <5B8DA87D05A7694D9FA63FD143655C1B9D9EEC12@hasmsx109.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5B8DA87D05A7694D9FA63FD143655C1B9D9EEC12@hasmsx109.ger.corp.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 11, 2018 at 01:27:58PM +0000, Winkler, Tomas wrote: > > > > On Wed, Oct 10, 2018 at 08:06:38AM -0600, Jason Gunthorpe wrote: > > > On Wed, Oct 10, 2018 at 03:38:17PM +0200, Gustavo A. R. Silva wrote: > > > > Currently, there are some values assigned to variable *rc*, which > > > > are never actually used in any computation, because such variable is > > > > updated at line 550, before they can be used: > > > > > > > > 549out: > > > > 550 rc = tpm_go_idle(chip, flags); > > > > 551 if (rc) > > > > 552 goto out; > > > > > > > > Fix this by removing such assignments. > > > > > > Should this be done by not quashing rc during the error unwind rather > > > than dropping the errors? > > > > Yeah.` > > > > Wondering if tpm_go_idle() should simply be a void-function i.e. issue just a > > warning inside (disclaimer: did not revisit its code when writing this). > > We did have rather a long discussion about it when it was merged. > There are two flows that may crash > rc = tpm2_commit_space() > > but you still can need to > > rc = go_idle() > > which also may crash which may override the previous value. > > Frankly the second one is fatal, the stack will go out of sync. > We may do void here as the stack will crash in a subsequent command. > > The 'goto out' is quite a bug, probably caused by code movement. I just looked at the code properly and noticed that there is a regression caused by 627448e85c76 ("tpm: separate cmd_ready/go_idle from runtime_pm") i.e. when tpm_go_idle() fails it loops back and retries tpm_go_idle(). /Jarkko