From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752143AbdASKuh (ORCPT ); Thu, 19 Jan 2017 05:50:37 -0500 Received: from mga02.intel.com ([134.134.136.20]:50955 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751661AbdASKub (ORCPT ); Thu, 19 Jan 2017 05:50:31 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,253,1477983600"; d="scan'208";a="54817270" Date: Thu, 19 Jan 2017 12:49:22 +0200 From: Jarkko Sakkinen To: James Bottomley Cc: tpmdd-devel@lists.sourceforge.net, open list , linux-security-module@vger.kernel.org Subject: Re: [tpmdd-devel] [PATCH RFC v3 5/5] tpm2: expose resource manager via a device link /dev/tpms Message-ID: <20170119104922.vhgz4rxw6yzdrxqt@intel.com> References: <20170116131215.28930-1-jarkko.sakkinen@linux.intel.com> <20170116131215.28930-6-jarkko.sakkinen@linux.intel.com> <1484751663.2717.10.camel@HansenPartnership.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1484751663.2717.10.camel@HansenPartnership.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.6.2-neo (2016-08-21) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 18, 2017 at 10:01:03AM -0500, James Bottomley wrote: > On Mon, 2017-01-16 at 15:12 +0200, Jarkko Sakkinen wrote: > > From: James Bottomley > > > > Currently the Resource Manager (RM) is not exposed to userspace. > > Make > > this exposure via a separate device, which can now be opened multiple > > times because each read/write transaction goes separately via the RM. > > > > Concurrency is protected by the chip->tpm_mutex for each read/write > > transaction separately. The TPM is cleared of all transient objects > > by the time the mutex is dropped, so there should be no interference > > between the kernel and userspace. > > There's actually a missing kfree of context_buf on the tpms_release > path as well. This patch fixes it up. Can you send me a fresh version of the whole patch so that I can include to v4 that includes also changes that I requested in my recent comments + all the fixes? /Jarkko > > James > > --- > > commit 778425973c532a0c1ec2b5b2ccd7ff995e2cc9db > Author: James Bottomley > Date: Wed Jan 18 09:58:23 2017 -0500 > > add missing kfree to tpms_release > > diff --git a/drivers/char/tpm/tpms-dev.c b/drivers/char/tpm/tpms-dev.c > index c10b308..6bb687f 100644 > --- a/drivers/char/tpm/tpms-dev.c > +++ b/drivers/char/tpm/tpms-dev.c > @@ -37,6 +37,7 @@ static int tpms_release(struct inode *inode, struct file *file) > struct tpms_priv *priv = container_of(fpriv, struct tpms_priv, priv); > > tpm_common_release(file, fpriv); > + kfree(priv->space.context_buf); > kfree(priv); > > return 0; >