From patchwork Wed Jan 18 15:01:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Bottomley X-Patchwork-Id: 9524057 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C55F56020A for ; Wed, 18 Jan 2017 15:01:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B45E3285B6 for ; Wed, 18 Jan 2017 15:01:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A51C8285B9; Wed, 18 Jan 2017 15:01:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97A73285F9 for ; Wed, 18 Jan 2017 15:01:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751482AbdARPBI (ORCPT ); Wed, 18 Jan 2017 10:01:08 -0500 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:44580 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751409AbdARPBH (ORCPT ); Wed, 18 Jan 2017 10:01:07 -0500 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id C810A8EE216; Wed, 18 Jan 2017 07:01:06 -0800 (PST) Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FJLtlJUkvncZ; Wed, 18 Jan 2017 07:01:06 -0800 (PST) Received: from [9.232.160.153] (unknown [129.33.253.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id E21378EE07D; Wed, 18 Jan 2017 07:01:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1484751666; bh=zeyLbCZj2N6RMClTNyi+zFqFlheIkfZnXEuCzUvsSbM=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=RynocDWXL1pPAwG+zY92Q17qpf5c8S9xSYIW1RoeuBFCWhEjW809CZjPTBb24h6n5 hN4KLd/dpPZTGbLOjIXIKPnOdPFzCiif+PF+JypQYpepdT2lBdX7aNpTOM6WtbR+Jl AfYk2TP/3X8kBhfCjJ3vaUL40AOckVDERF1jVmkk= Message-ID: <1484751663.2717.10.camel@HansenPartnership.com> Subject: Re: [tpmdd-devel] [PATCH RFC v3 5/5] tpm2: expose resource manager via a device link /dev/tpms From: James Bottomley To: Jarkko Sakkinen , tpmdd-devel@lists.sourceforge.net Cc: open list , linux-security-module@vger.kernel.org Date: Wed, 18 Jan 2017 10:01:03 -0500 In-Reply-To: <20170116131215.28930-6-jarkko.sakkinen@linux.intel.com> References: <20170116131215.28930-1-jarkko.sakkinen@linux.intel.com> <20170116131215.28930-6-jarkko.sakkinen@linux.intel.com> X-Mailer: Evolution 3.16.5 Mime-Version: 1.0 Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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. James --- commit 778425973c532a0c1ec2b5b2ccd7ff995e2cc9db Author: James Bottomley Date: Wed Jan 18 09:58:23 2017 -0500 add missing kfree to tpms_release -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;