From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Stefan Berger <stefanb@linux.vnet.ibm.com>
Cc: tpmdd-devel@lists.sourceforge.net,
open list <linux-kernel@vger.kernel.org>,
linux-security-module@vger.kernel.org
Subject: Re: [tpmdd-devel] [PATCH RFC v4 1/5] tpm: validate TPM 2.0 commands
Date: Mon, 23 Jan 2017 23:44:35 +0200 [thread overview]
Message-ID: <20170123214435.6aa75rgy6b3gdfpv@intel.com> (raw)
In-Reply-To: <b5837ab8-0edd-86cf-c17d-36d55754219e@linux.vnet.ibm.com>
On Sun, Jan 22, 2017 at 09:02:17PM -0500, Stefan Berger wrote:
> On 01/22/2017 06:44 PM, Jarkko Sakkinen wrote:
> > @@ -1025,8 +1029,60 @@ int tpm2_auto_startup(struct tpm_chip *chip)
> > }
> > }
> >
> > + rc = tpm2_get_tpm_pt(chip, TPM_PT_TOTAL_COMMANDS, &nr_commands, NULL);
> > + if (rc)
> > + goto out;
> > +
> > + /* sanity check */
> > + if (nr_commands > INT_MAX) {
> > + rc = -E2BIG;
> > + goto out;
> > + }
> > +
> > + chip->cc_attrs_tbl = devm_kzalloc(&chip->dev, 4 * nr_commands,
> > + GFP_KERNEL);
> > +
> > + rc = tpm_buf_init(&buf, TPM2_ST_NO_SESSIONS, TPM2_CC_GET_CAPABILITY);
> > + if (rc)
> > + goto out;
> > +
> > + tpm_buf_append_u32(&buf, TPM2_CAP_COMMANDS);
> > + tpm_buf_append_u32(&buf, TPM2_CC_FIRST);
> > + tpm_buf_append_u32(&buf, nr_commands);
> > +
> > + rc = tpm_transmit_cmd(chip, buf.data, PAGE_SIZE, 0, 0, NULL);
>
> You should probably pass the min_rsp_body_size as 5 + 4 + nr_commands * 4
Thanks. I'll put 9 + 4 * nr_commands as the expected size.
/Jarkko
next prev parent reply other threads:[~2017-01-23 21:47 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-22 23:44 [PATCH RFC v4 0/5] RFC: in-kernel resource manager Jarkko Sakkinen
2017-01-22 23:44 ` [PATCH RFC v4 1/5] tpm: validate TPM 2.0 commands Jarkko Sakkinen
2017-01-23 2:02 ` [tpmdd-devel] " Stefan Berger
2017-01-23 21:44 ` Jarkko Sakkinen [this message]
2017-01-22 23:44 ` [PATCH RFC v4 2/5] tpm: export tpm2_flush_context_cmd Jarkko Sakkinen
2017-01-22 23:44 ` [PATCH RFC v4 3/5] tpm: infrastructure for TPM spaces Jarkko Sakkinen
2017-01-23 0:00 ` Jarkko Sakkinen
2017-01-22 23:44 ` [PATCH RFC v4 4/5] tpm: split out tpm-dev.c into tpm-dev.c and tpm-common-dev.c Jarkko Sakkinen
2017-01-23 16:47 ` Jason Gunthorpe
2017-01-23 22:28 ` [tpmdd-devel] " James Bottomley
2017-01-23 22:49 ` Jason Gunthorpe
2017-01-23 22:57 ` James Bottomley
2017-01-23 23:04 ` Jason Gunthorpe
2017-01-23 23:20 ` James Bottomley
2017-01-23 23:30 ` Jason Gunthorpe
2017-01-23 23:45 ` James Bottomley
2017-01-24 0:04 ` Jason Gunthorpe
2017-01-24 14:30 ` Jarkko Sakkinen
2017-01-24 14:28 ` Jarkko Sakkinen
2017-01-22 23:44 ` [PATCH RFC v4 5/5] tpm2: expose spaces via a device link /dev/tpms<n> Jarkko Sakkinen
2017-01-22 23:50 ` [PATCH RFC v4 0/5] RFC: in-kernel resource manager Jarkko Sakkinen
2017-01-23 17:01 ` [tpmdd-devel] " James Bottomley
2017-01-24 0:04 ` Jarkko Sakkinen
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=20170123214435.6aa75rgy6b3gdfpv@intel.com \
--to=jarkko.sakkinen@linux.intel.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