Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3978077pxj; Tue, 11 May 2021 16:47:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqfP3dlZ/Ezxnse7+5hqCFUL/GwJZM0kILPz6w3SLqEBzbHeYSOyN8nOtC2Iob60AD1XoK X-Received: by 2002:a17:906:3453:: with SMTP id d19mr34013058ejb.545.1620776839272; Tue, 11 May 2021 16:47:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620776839; cv=none; d=google.com; s=arc-20160816; b=DfbagPFMLgEz69GunqQwN+qxKnzvkf4Ss8e9/0CJsYGUjG71+NUxjuOIrVw57f2X6e SAKlHNfakbriukvI08Ag2ISnxW6LZ6ICEnL+e3uiDjTlnq8Hc1WPu7erJGmVJ/YoCmLn OLDr232es48/a+hMR3V8s08YAqthA1sDTM4NiL5ob0P+GxEFg81pu9NM2E3d2yYwOlxT TM/1IEV9z2wXITCHD30hT1BjYjpc1wY+7o4WJDrBNXTWqGudS/PzKvAgPEKUIW/PPYSB 5qusbNlIHjTWlJBBBOUT4+cO/uD36IpOJEOgeNqVDFqHzlzcUJVQ6ksCK8Q7ZBMJpCuQ f1YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=u0tjFyNNwFLGpuXUmeNy/LWmdirvNxyQhG+agig15Xw=; b=dFxsgAW4OfQC5v6lXEH/AM7rH+rDiOtmtsllX6/kw1IF9idVmIU3J5k96kUZC6VmVD 0ogbbXVkkucgz9rpsJuTsdAp6XKNTInGa6dM60Xjl/YizSLfZRDUdntnVNGbj/UpE+IR U43KN+D3Ezfb4n+AAHqezt2FX8XnhlEbTPxKU+n/IJud1WAC78pXQI0UbJ2JJRAng5Gq XYvN2rvamHdSP8GxJx9c0ACmPZobSCF136QgFxjenQExKtTbba6MScB1GnqrWBN0dqQB iQnXLT9UK8Bnt+Xqnw0o7d8t7xwn79nsEw+fW5RZeOoRiAEsyuG+3vrqZ+CnD0pfIW7/ fXmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nyTRZBuc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n26si18614598edr.190.2021.05.11.16.46.54; Tue, 11 May 2021 16:47:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nyTRZBuc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229925AbhEKXrJ (ORCPT + 99 others); Tue, 11 May 2021 19:47:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:60732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbhEKXrI (ORCPT ); Tue, 11 May 2021 19:47:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2FE92616ED; Tue, 11 May 2021 23:46:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620776761; bh=0dmp162/xsNE25srlIIbfhkW/kO41/gT68NUM2wciFs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nyTRZBucYOeqw2vkr6jt8K1K9YKPRokln6A0hKzWn6zXxu1PMhghuGw4iZRuGMbq8 F6hRFqUa/+D/pWZMg335CKhbZGN0mGL0TY7aRceEgJkCr6LQSj6VIF4kTzLRviRWhY wX/x7vfChk+TN1rrR2N1NWQSxd4/iRKZclR99qHn9aFzOnO+BIkYvmO2ZFDT8We0hl ZsOcHF0blzsikb++K6f3cWTuw1hn9SZ3izJlueCYIsTujlnX0ymBGI8eGST6DOCUpL ZANYL/7tBJTDhUjew7u4m991kYau7sWkZhfak1Rc19lATHSsFhvSivRmQQleIFPtW3 7f2CqLAO8SJ5Q== Date: Wed, 12 May 2021 02:45:59 +0300 From: Jarkko Sakkinen To: Ben Boeckel Cc: keyrings@vger.kernel.org, Ben Boeckel , James Bottomley , linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Dan Carpenter Subject: Re: [PATCH v2 1/1] trusted-keys: match tpm_get_ops on all return paths Message-ID: References: <20210429192156.770145-1-list.lkml.keyrings@me.benboeckel.net> <20210429192156.770145-2-list.lkml.keyrings@me.benboeckel.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 10, 2021 at 05:04:33PM -0400, Ben Boeckel wrote: > On Thu, Apr 29, 2021 at 15:21:56 -0400, Ben Boeckel wrote: > > From: Ben Boeckel > > > > The `tpm_get_ops` call at the beginning of the function is not paired > > with a `tpm_put_ops` on this return path. > > > > Fixes: f2219745250f ("security: keys: trusted: use ASN.1 TPM2 key format for the blobs") > > Reported-by: Dan Carpenter > > Signed-off-by: Ben Boeckel > > --- > > security/keys/trusted-keys/trusted_tpm2.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/security/keys/trusted-keys/trusted_tpm2.c b/security/keys/trusted-keys/trusted_tpm2.c > > index 617fabd4d913..0165da386289 100644 > > --- a/security/keys/trusted-keys/trusted_tpm2.c > > +++ b/security/keys/trusted-keys/trusted_tpm2.c > > @@ -336,9 +336,9 @@ int tpm2_seal_trusted(struct tpm_chip *chip, > > rc = -EPERM; > > } > > if (blob_len < 0) > > - return blob_len; > > - > > - payload->blob_len = blob_len; > > + rc = blob_len; > > + else > > + payload->blob_len = blob_len; > > > > tpm_put_ops(chip); > > return rc; > > Ping? Is this going to make 5.13? This fixes an issue that is in > 5.13-rc1. > > --Ben I applied it, probably will do additional PR for v5.13 in order to fix some urgent tpm_tis issues, so I'll include this to the same pull request. Thanks for fixing this! /Jarkko