From: Jarkko Sakkinen <jarkko@kernel.org>
To: James Bottomley <James.Bottomley@HansenPartnership.com>,
linux-integrity@vger.kernel.org
Cc: stable@vger.kernel.org, Mimi Zohar <zohar@linux.ibm.com>,
David Howells <dhowells@redhat.com>,
Paul Moore <paul@paul-moore.com>,
James Morris <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
keyrings@vger.kernel.org, linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] tpm: Relocate buf->handles to appropriate place
Date: Wed, 17 Jul 2024 12:27:50 +0300 [thread overview]
Message-ID: <527dce2173da6f65753109d674882979736c152e.camel@kernel.org> (raw)
In-Reply-To: <36ceafb1513fac502fdfce8fb330fc6e18db47ce.camel@HansenPartnership.com>
On Tue, 2024-07-16 at 15:32 -0400, James Bottomley wrote:
> On Tue, 2024-07-16 at 21:52 +0300, Jarkko Sakkinen wrote:
> [...]
> > Further, 'handles' was incorrectly place to struct tpm_buf, as tpm-
> > buf.c does manage its state. It is easy to grep that only piece of
> > code that actually uses the field is tpm2-sessions.c.
> >
> > Address the issues by moving the variable to struct tpm_chip.
>
> That's really not a good idea, you should keep counts local to the
> structures they're counting, not elsewhere.
>
> tpm_buf->handles counts the number of handles present in the command
> encoded in a particular tpm_buf. Right at the moment we only ever
> construct one tpm_buf per tpm (i.e. per tpm_chip) at any one time, so
> you can get away with moving handles into tpm_chip. If we ever
> constructed more than one tpm_buf per chip, the handles count would
> become corrupted.
It is not an idea. That count is in the wrong place. Buffer code
has no use for it.
BR, Jarkko
next prev parent reply other threads:[~2024-07-17 9:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-16 18:52 [PATCH v3] tpm: Relocate buf->handles to appropriate place Jarkko Sakkinen
2024-07-16 18:54 ` Jarkko Sakkinen
2024-07-16 19:32 ` James Bottomley
2024-07-17 9:27 ` Jarkko Sakkinen [this message]
2024-07-17 9:31 ` Jarkko Sakkinen
2024-07-17 9:34 ` Jarkko Sakkinen
2024-07-17 9:55 ` Jonathan McDowell
2024-07-17 11:23 ` 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=527dce2173da6f65753109d674882979736c152e.camel@kernel.org \
--to=jarkko@kernel.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=dhowells@redhat.com \
--cc=jmorris@namei.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=serge@hallyn.com \
--cc=stable@vger.kernel.org \
--cc=zohar@linux.ibm.com \
/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 NNTP newsgroup(s).