Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3974257pxj; Tue, 11 May 2021 16:40:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEdL0MQHu2Ae3i6w+lN+qU7IoM+dGsrTP5YoON/DVHdV/0bs8/R4UdC/g7XQPk3e3+zF99 X-Received: by 2002:a05:6830:214f:: with SMTP id r15mr27672013otd.204.1620776404610; Tue, 11 May 2021 16:40:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620776404; cv=none; d=google.com; s=arc-20160816; b=EBNhc2m9qxQzTouoMO3Z42PakpcusoPsBfhuCzUT6DwbL4B7D0wrRHIFWMdjUSXHAh ctxtTdR70VwPLH/Jee9M4u4/hVQwcwzh3L1owQuM/csWEswNA35UI8SjD0IRPLd3wROs DLt1icuu5TWLj8lfSZDke6PMECsCVA23OkK4r+2P1El2zeD7Zg8rr3FAIHu1DVwOS01C WdTn7BisDx/BukM3a0E9zrV4K3gH1kiStyAwNaG5c8QOHmTMr2aBuIM3qswqJ55dvfz1 M8C/jQxEvgivZ2HIWU3oldSjeBA3FsD8MwDVC6zGMJefXljjzL7O4nUD5VWFHqNMDUMT kihA== 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=eLiiFOB4VqqOb6IICumu54BwZ1QZXbp+A49yg+F+U9A=; b=aIpCBfdJ+nKRrwmNEFfPlAheRFndiC7fYUsCaLp8ddWu8LQ9LNdRQFGIHVFnFNyuiA wxdmNRE0QgEOlxMRcPcR2koyA5m3Pq+OdaMLpoLIkMSMjK+oDlI5hmN3uPm/FcO4UUaH zJj46ZtlyBcAyS7Higxw+of4+peQvj0xE+IwgCahnWsPNDFscxZcAgxvwys9z44ajkVL pUsK0qyb/wecySD4eoCFVdMgOCZ9/s/BSXwQ9FJHtj1OwP2NYhGuqTL0mZqypzAfdnG3 X748KRpkLT4qjPNcfE8wSSWEBiV+N/1OQbXrdU1xTD9TdT0FKXaGpXZOmv3J3fr1mPI/ o97Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N3NSyN2U; 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 h6si14563803oth.163.2021.05.11.16.39.51; Tue, 11 May 2021 16:40:04 -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=N3NSyN2U; 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 S230005AbhEKXkU (ORCPT + 99 others); Tue, 11 May 2021 19:40:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:57534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbhEKXkT (ORCPT ); Tue, 11 May 2021 19:40:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 58A28616ED; Tue, 11 May 2021 23:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620776352; bh=opdv1vl7F9qgMxjqwo7kS8bgDqLanKuizbh/7bPX1d0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=N3NSyN2UVXQiYlvizM1YqCinboJ8Wfii4PUN8SQhqD2QB0Xdnv7Ykj1YG8mKI7Cpf gqfrvt2QHJN8Ujb8u7niKauxwRL0mVCx3tBXUXRMSb4TkETeZUY00rBLWwMa5AejPn lRUxCviwZNMoyS78geR89xun0Oi6LkcYwVkK4L0kchVgOB7Em0xQPMoXYjF7F2m5OJ NCRaol8+SGYnCe4+bFkSkhbX2Fis4hbFXVVlByLTCe9UazKq750ROu3np0ksNhWiYb CJgjqTdVc74bnX/H/W2Oce8NWva5s3HorKX2DRFNGN5SbuCLZ9aebr0f2/b8UVYcUS fE2bTwZsUkPfQ== Date: Wed, 12 May 2021 02:39:10 +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. Reviewed-by: Jarkko Sakkinen /Jarkko