From patchwork Wed Mar 2 09:43:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12765697 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE358C433FE for ; Wed, 2 Mar 2022 09:45:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240599AbiCBJpq (ORCPT ); Wed, 2 Mar 2022 04:45:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236428AbiCBJpl (ORCPT ); Wed, 2 Mar 2022 04:45:41 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 846A63E0DB; Wed, 2 Mar 2022 01:44:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1646214280; bh=u9LSPz59K1AzPPN6pInj51OX5iy0BC9R1p2p2gRRKlw=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=RgiNI2s9vyP54Ko9/bcmrrJQiUWzk9+jfb9hYoQFLW4NukPqoz/JnX8ryxn6dyRsA cAFmyCUfn/952XqDYp7oowb6tS7b5YXWFwM5H9IW85DgUnnzD0ZkOA3HEGIW3CDTf0 J1dIqkBqnS/X2S1BJpShANLGb0C4ooEanfUyRyX0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([149.172.237.68]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MNKhs-1nZqD41NCU-00Oo4K; Wed, 02 Mar 2022 10:44:40 +0100 From: Lino Sanfilippo To: peterhuewe@gmx.de, jarkko@kernel.org, jgg@ziepe.ca Cc: stefanb@linux.vnet.ibm.com, James.Bottomley@hansenpartnership.com, David.Laight@ACULAB.COM, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, p.rosenberger@kunbus.com, LinoSanfilippo@gmx.de Subject: [PATCH v9 0/1] This patch fixes a reference count issue in the TPM core code Date: Wed, 2 Mar 2022 10:43:52 +0100 Message-Id: <20220302094353.3465-1-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:XbTfDc6oHSCC25zdRUunVw99wBhP91zXTkKy535tLuopP8UW2zH UcwxtuHNs9MHp6wXsanhY3J6y2Qi4FwhC2vMWIWlDLUGuLC2a8OAPnGkrs/66MAMVac5Oyf 14CIbMrQ3eJI4V+k3z05oP1KT+aX9/BiL9g/rogezOCbEXL2LcrdUQIruMBxoHkFnlB7XWr SCm5lfZtS9mnNVr9v1lIQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:KwwNtkS5whI=:tA2uaPOWm7pkCpadfCQx8o 2R+zz7vHdl7YyLLJ6Kju4vO5MVpY0RdLf8s/eTo1Yl17dbgxLe+B4AxatJzMx4meEMBdM0+9x /Pw+dKYMqIoc827ykUUfS3V3ixd4+rNr7AW+8K/DoXq7W8wykCYe2tHvCm5nqHDUN5ICRAtWj 8hO7a/SALSJjaJzivSFCi/h99lHIRkNZJGEYGqmksfR9uF2OqiXf52fLQyKk2S/jByXRSZQKl iXwg9fxuNN9MT+KkmumrS4x7VOzH7y3awgedFf0RTOj+0zUuDyG52Xh+YhGeOdF/7TEE/KXbm mEd6bZ3i2/saERfK/DVpQR73Q9vVXzTscCyWo+YSToJ+Qdx8nRTYrPMrKKJ1r/K6rWT/H3jx4 t7iaxU1fAy+MYdqMhhlAQcmc2roJ/5FYicwNLVg4uO6s8tnpyk0abMxsfsXHixP1lZWhSKLPh lpETKQxF2eJGc9dHGC1sqbhmOxsJDvk32feyLmd3gnho4Fu5sD/KEFzCGQM642oHHiTZU93lh K+rxX9QTbSRuVOsvCe9s8/LsT5crF/hf4xA+8w318xUBdc9JkujzbMvC7QfTGu61y0Zq7JCq1 fKWVvqRxpnhURmqjYNuTzOIKM/7abO027/9jfCGsmjVI6Y0NEVmRhBnn9mwWEjIDW3NU2jS7W eJQnEpL2Sgtl1ZVxijBdZYN5GeJUJqmIrXuz/BIeTQ6aNxa0uLRUbcFu9qMVqKkNKgLCaNdGg Svl8SvgPkmBJp0XBCEaCqvZP5J+wSq6xx9DiIRddJWlQX7mF+cIwOQMOYpQrs682pAl4WRJwd 0ogTZoJ1oOEIJ6ogYbw6ySsUIgLAgzr8MVry6sfvHlcVPhZ1AJ6zMa+nmrFS2xqST5KlmZrRX S6HiJz288+wVoQeztMh47pLBHsqTBwbDSkd3RIbypxKb+3ZzG6WBuXPCCDyhpA1rktRMqE3Sp 3sJgSa06vUdPsv5wSlADotR5jjHECsxK5bqgpTSakDnMjpkDs2y+FCl/TSMzutbLr1LXzdmhh 8eXKuvhW6MjvbXKTmTWwbMUNerawRm7YN1H88QZxhxzB94NOsSBTsDYbrFncjYLd8jkqKu7Ao xToYPo0BPXVs+M= Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org Changes in v9: - add a function tpm_devs_remove() as counterpart to tpm_devs_add() as suggested by Jason Changes in v8: - adjust names of jump labels for as requested by Jarkko Changes in v7: - adjust naming of jump labels to fit better the used label naming scheme Changes in v6: - rename function tpm2_add_device() to tpm_devs_add() as requested by Jarko - add function descriptions - fix source code formatting Changes in v5: - move function tpm_add_tpm2_char_device() to tpm2-space.c and rename it to tpm2_add_device() as requested by Jarko - put "cc" tag before all other tags - ensure that the error path in tpm2_add_device() always calls the release() function of chip->devs as requested by Jason - reformat a code line as suggested by David Laight Changes in v4: - drop patch 2 (tpm: in tpm2_del_space check if ops pointer is still valid) since James Bottomley offered a cleaner solution for this - reimplement patch 1 to setup the /dev/tpmrm device only in case of TPM2 and avoid the installation of another action handler. This is based on a suggestion and basic implementation done by Jason Gunthorpe. - added tag to CC stable Changes in v3: - drop the patch that introduces the new function tpm_chip_free() - rework the commit messages for the patches (style, typos, etc.) - add fixes tag to patch 2 - add James Bottomley to cc list - add stable mailing list to cc list Changes in v2: - drop the patch that erroneously cleaned up after failed installation of an action handler in tpmm_chip_alloc() (pointed out by Jarkko Sakkinen) - make the commit message for patch 1 more detailed - add fixes tags and kernel logs Lino Sanfilippo (1): tpm: fix reference counting for struct tpm_chip drivers/char/tpm/tpm-chip.c | 46 +++++-------------------- drivers/char/tpm/tpm.h | 2 ++ drivers/char/tpm/tpm2-space.c | 65 +++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 38 deletions(-) base-commit: c8db90d3e723086a54be83e0a2b108146c57e0de