Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2927336pxj; Mon, 10 May 2021 14:06:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzISoN+PT4u3gIDo/dMgKk++3YgchdmfbmOxrud4lO6lDTzQptdbA/hN7H5oSJEdnpLuTbL X-Received: by 2002:a17:907:3e0b:: with SMTP id hp11mr26746241ejc.171.1620680774965; Mon, 10 May 2021 14:06:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620680774; cv=none; d=google.com; s=arc-20160816; b=QiPQ02QftCd1CcVyRkFNVct4JZr2iAjX4z1+vZBtkDcW+E62MulPGHPwk0Mri2n6F+ hfIGd+97I2N8lFTVaJirntGUwWldhDGTICmtHY1HqpO1hGBBSeOjOWzkdHoFYcDw8Hbp ZkiWQ9vHP3LO7py2LwiJdQqKGXk9KcOX5pfjVcxofdjmfoHF+S9E4uo3nKCzpsHTq8UV h/nmotTqYtKuC0DCdP3LAFijlxqB7kQFdYwsM/JBgkvk8KJ7JDglU+SD7S1ffMv0wSFe 1SOSbcEoUHpeNJ1GXDlHyz2DJTWNoxmHf66RG1ACv1VWhyKqoonCUhACheSJ3uG/Dry5 4GpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=b+B/Ao5TBLbn8YtT21sbRFDG8tsSsyhgsy6rowzSCO8=; b=Y2wqPIbFmyAp7Zmj8+TtGpyXP3lWjr8CC1XE3NkB3M73SnDo7GwwlgCyOrMOGm3fbM GULHaSdYYE2EhafmhYXXJOTy0mfV7NrEayc3D4c0rIUKJ/lhwDcahprxqdaD8ojuqhtx V1ZMrrkRPMEAKPSoX1cvckW/y5CA8+/OvqmxR7GZRufh+jLEZuNDUUjphHjtDj/z9SSe Nc8ReKC8ZwBNvvXU2f54GwQ5wjvPXe4nHcrWEAWpvKyPNSbkULcghuuljrRcCJsb/su/ ycLxSGGSDyuRpJUDmm+LN8ndOcmI5hnaIDfK/iMk8BW+H6rM+92fqWPPmy7tmrKUQwFs YoYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@benboeckel.net header.s=fm1 header.b=iFZ2Hrvx; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Uci6YFmo; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b1si16311877ejb.714.2021.05.10.14.05.50; Mon, 10 May 2021 14:06:14 -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=@benboeckel.net header.s=fm1 header.b=iFZ2Hrvx; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Uci6YFmo; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231190AbhEJVFq (ORCPT + 99 others); Mon, 10 May 2021 17:05:46 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:44985 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230165AbhEJVFq (ORCPT ); Mon, 10 May 2021 17:05:46 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 463445C004F; Mon, 10 May 2021 17:04:36 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 10 May 2021 17:04:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benboeckel.net; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=b+B/Ao5TBLbn8YtT21sbRFDG8ts Ssyhgsy6rowzSCO8=; b=iFZ2Hrvxjx+zZkLTKCjSMtsUAvMgvSOiqGpIyAMCdCn 7//m6GaTjkoIdvzqZDdIpAVkcQMlvCIAzK3yu/Dk2FMasgkr8BCV+edU6hkjXtsY aTf7Dw7PV3epQNz9PES8WumbNqFIVxtmvc9Q02ZbiNPTPZd19BtAKK7kGRP2PPsU F4r2svNX59SQu2Iz/pMrbYfjMK9yZPNcPq274JbGkjxI3bHqjigbDvO6/yIIf52v /HhCIMuJVBPhI3i9lgHIsLvjEeQq/GmY/MwWuRgR5PGgBt0mQ4Kt1b5ogsdPVZQZ s549O5y35DEHrPbz7PF92M5kxBrJMmVdkwAr9TqmiSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=b+B/Ao 5TBLbn8YtT21sbRFDG8tsSsyhgsy6rowzSCO8=; b=Uci6YFmok17WNk7jqxrnKX KXS9dQeGedD0sYZJazlhh3LbN3dvi/j5QecsUh7Y+OBjHI9WmK4tjgN52D+0hWY+ AgYvISA7Rhpq4evPc831YZz9xEUGnDt+jBPmullaHqgSZCTMA/VG9TkCgTsCKZvI VqvG9L4fJB2yT9+WxNib7wM2VUZ/asDy20PU5h+q60oInIk3A0CMU+U29mtEgr5O yWmjjPDu3i3BXHMY34lM2HPB5PS8JsCP540SnGD8RCUwZ6bKNZ0wkuQ1WOVHLQjF e09AH4UJW7ypLFz06pyyxl8IDj/7s10Ln7bFw/0mz3BsPHCru0caaOGiDmQJm93g == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdegkedgudehkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujggfsehttdertddtreejnecuhfhrohhmpeeuvghn uceuohgvtghkvghluceomhgvsegsvghnsghovggtkhgvlhdrnhgvtheqnecuggftrfgrth htvghrnhepvefftdettefgtddtkeeufeegtddttdeuueegkeegteffueetffejudeihefh kedtnecukfhppedvgedrudeiledrvddtrddvheehnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhgvsegsvghnsghovggtkhgvlhdrnhgvth X-ME-Proxy: Received: from localhost (unknown [24.169.20.255]) by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 10 May 2021 17:04:35 -0400 (EDT) Date: Mon, 10 May 2021 17:04:33 -0400 From: Ben Boeckel To: keyrings@vger.kernel.org Cc: 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=utf-8 Content-Disposition: inline In-Reply-To: <20210429192156.770145-2-list.lkml.keyrings@me.benboeckel.net> User-Agent: Mutt/2.0.5 (2021-01-21) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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