From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: peterhuewe@gmx.de, tpmdd-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [tpmdd-devel] [PATCH] tpm: missing tpm_chip_put in tpm_get_random()
Date: Fri, 9 May 2014 10:22:36 -0600 [thread overview]
Message-ID: <20140509162235.GA16647@obsidianresearch.com> (raw)
In-Reply-To: <1399634590-8360-1-git-send-email-jarkko.sakkinen@linux.intel.com>
On Fri, May 09, 2014 at 02:23:10PM +0300, Jarkko Sakkinen wrote:
> Regression in 41ab999c. Call to tpm_chip_put is missing. This
> will cause TPM device driver not to unload if tmp_get_random()
> is called.
>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> drivers/char/tpm/tpm-interface.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> index 62e10fd..4ea4d52 100644
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -991,13 +991,13 @@ int tpm_get_random(u32 chip_num, u8 *out, size_t max)
> int err, total = 0, retries = 5;
> u8 *dest = out;
>
> + if (!out || !num_bytes || max > TPM_MAX_RNG_DATA)
> + return -EINVAL;
> +
> chip = tpm_chip_find_get(chip_num);
> if (chip == NULL)
> return -ENODEV;
>
> - if (!out || !num_bytes || max > TPM_MAX_RNG_DATA)
> - return -EINVAL;
> -
> do {
> tpm_cmd.header.in = tpm_getrandom_header;
> tpm_cmd.params.getrandom_in.num_bytes = cpu_to_be32(num_bytes);
> @@ -1016,6 +1016,7 @@ int tpm_get_random(u32 chip_num, u8 *out, size_t max)
> num_bytes -= recd;
> } while (retries-- && total < max);
>
> + tpm_chip_put(chip);
> return total ? total : -EIO;
> }
> EXPORT_SYMBOL_GPL(tpm_get_random);
prev parent reply other threads:[~2014-05-09 16:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-09 11:23 [PATCH] tpm: missing tpm_chip_put in tpm_get_random() Jarkko Sakkinen
2014-05-09 16:22 ` Jason Gunthorpe [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=20140509162235.GA16647@obsidianresearch.com \
--to=jgunthorpe@obsidianresearch.com \
--cc=jarkko.sakkinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterhuewe@gmx.de \
--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