From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Stefan Berger <stefanb@linux.vnet.ibm.com>
Cc: tpmdd-devel@lists.sourceforge.net,
linux-security-module@vger.kernel.org,
James.Bottomley@HansenPartnership.com,
jgunthorpe@obsidianresearch.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tpm: Fix reference count to main device
Date: Wed, 19 Apr 2017 18:30:36 +0300 [thread overview]
Message-ID: <20170419153036.7bcax775wskrskdo@intel.com> (raw)
In-Reply-To: <1492480706-6928-1-git-send-email-stefanb@linux.vnet.ibm.com>
On Mon, Apr 17, 2017 at 09:58:26PM -0400, Stefan Berger wrote:
> The main device is currently not properly released due to one additional
> reference to the 'devs' device which is only released in case of a TPM 2.
> So, also get the additional reference only in case of a TPM2.
>
> Fixes: fdc915f7f719 ("tpm: expose spaces via a device link /dev/tpmrm<n>")
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Excellent, thank you. I'll send this with some other small fixes for
4.12 to James rather sooner than later.
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
/Jarkko
>
> ---
> drivers/char/tpm/tpm-chip.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
> index a321bd5..9dec9f5 100644
> --- a/drivers/char/tpm/tpm-chip.c
> +++ b/drivers/char/tpm/tpm-chip.c
> @@ -191,9 +191,10 @@ struct tpm_chip *tpm_chip_alloc(struct device *pdev,
> /* get extra reference on main device to hold on
> * behalf of devs. This holds the chip structure
> * while cdevs is in use. The corresponding put
> - * is in the tpm_devs_release
> + * is in the tpm_devs_release (TPM2 only)
> */
> - get_device(&chip->dev);
> + if (chip->flags & TPM_CHIP_FLAG_TPM2)
> + get_device(&chip->dev);
>
> if (chip->dev_num == 0)
> chip->dev.devt = MKDEV(MISC_MAJOR, TPM_MINOR);
> --
> 2.4.3
>
prev parent reply other threads:[~2017-04-19 15:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-18 1:58 [PATCH] tpm: Fix reference count to main device Stefan Berger
2017-04-19 15:30 ` Jarkko Sakkinen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170419153036.7bcax775wskrskdo@intel.com \
--to=jarkko.sakkinen@linux.intel.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=jgunthorpe@obsidianresearch.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=stefanb@linux.vnet.ibm.com \
--cc=tpmdd-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).