<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/include/linux/tpm.h, branch v6.18.21</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.21</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.21'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-01-02T11:57:11+00:00</updated>
<entry>
<title>tpm2-sessions: Fix out of range indexing in name_size</title>
<updated>2026-01-02T11:57:11+00:00</updated>
<author>
<name>Jarkko Sakkinen</name>
<email>jarkko@kernel.org</email>
</author>
<published>2025-11-30T19:07:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=04a3aa6e8c5f878cc51a8a1c90b6d3c54079bc43'/>
<id>urn:sha1:04a3aa6e8c5f878cc51a8a1c90b6d3c54079bc43</id>
<content type='text'>
commit 6e9722e9a7bfe1bbad649937c811076acf86e1fd upstream.

'name_size' does not have any range checks, and it just directly indexes
with TPM_ALG_ID, which could lead into memory corruption at worst.

Address the issue by only processing known values and returning -EINVAL for
unrecognized values.

Make also 'tpm_buf_append_name' and 'tpm_buf_fill_hmac_session' fallible so
that errors are detected before causing any spurious TPM traffic.

End also the authorization session on failure in both of the functions, as
the session state would be then by definition corrupted.

Cc: stable@vger.kernel.org # v6.10+
Fixes: 1085b8276bb4 ("tpm: Add the rest of the session HMAC API")
Reviewed-by: Jonathan McDowell &lt;noodles@meta.com&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tpm: Cap the number of PCR banks</title>
<updated>2026-01-02T11:57:09+00:00</updated>
<author>
<name>Jarkko Sakkinen</name>
<email>jarkko.sakkinen@opinsys.com</email>
</author>
<published>2025-09-30T12:58:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=858344bc9210bea9ab2bdc7e9e331ba84c164e50'/>
<id>urn:sha1:858344bc9210bea9ab2bdc7e9e331ba84c164e50</id>
<content type='text'>
commit faf07e611dfa464b201223a7253e9dc5ee0f3c9e upstream.

tpm2_get_pcr_allocation() does not cap any upper limit for the number of
banks. Cap the limit to eight banks so that out of bounds values coming
from external I/O cause on only limited harm.

Cc: stable@vger.kernel.org # v5.10+
Fixes: bcfff8384f6c ("tpm: dynamically allocate the allocated_banks array")
Tested-by: Lai Yi &lt;yi1.lai@linux.intel.com&gt;
Reviewed-by: Jonathan McDowell &lt;noodles@meta.com&gt;
Reviewed-by: Roberto Sassu &lt;roberto.sassu@huawei.com&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko.sakkinen@opinsys.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tpm: use a map for tpm2_calc_ordinal_duration()</title>
<updated>2025-10-10T05:21:45+00:00</updated>
<author>
<name>Jarkko Sakkinen</name>
<email>jarkko@kernel.org</email>
</author>
<published>2025-09-18T19:30:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=207696b17f38e869e59889b44d395ab24bb678d3'/>
<id>urn:sha1:207696b17f38e869e59889b44d395ab24bb678d3</id>
<content type='text'>
The current shenanigans for duration calculation introduce too much
complexity for a trivial problem, and further the code is hard to patch and
maintain.

Address these issues with a flat look-up table, which is easy to understand
and patch. If leaf driver specific patching is required in future, it is
easy enough to make a copy of this table during driver initialization and
add the chip parameter back.

'chip-&gt;duration' is retained for TPM 1.x.

As the first entry for this new behavior address TCG spec update mentioned
in this issue:

https://github.com/raspberrypi/linux/issues/7054

Therefore, for TPM_SelfTest the duration is set to 3000 ms.

This does not categorize a as bug, given that this is introduced to the
spec after the feature was originally made.

Reviewed-by: Serge Hallyn &lt;serge@hallyn.com&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'tpmdd-next-6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd</title>
<updated>2025-07-29T01:18:16+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2025-07-29T01:18:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4d40b59d8b0568769d10ac9b2a97e0af0a39d371'/>
<id>urn:sha1:4d40b59d8b0568769d10ac9b2a97e0af0a39d371</id>
<content type='text'>
Pull tpm updates from Jarkko Sakkinen:
 "Quite a few commits but nothing really that would be worth of spending
  too much time for, or would want to emphasize in particular"

* tag 'tpmdd-next-6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd:
  tpm_crb_ffa: handle tpm busy return code
  tpm_crb_ffa: Remove memset usage
  tpm_crb_ffa: Fix typos in function name
  tpm: Check for completion after timeout
  tpm: Use of_reserved_mem_region_to_resource() for "memory-region"
  tpm: Replace scnprintf() with sysfs_emit() and sysfs_emit_at() in sysfs show functions
  tpm_crb_ffa: Remove unused export
  tpm: tpm_crb_ffa: try to probe tpm_crb_ffa when it's built-in
  firmware: arm_ffa: Change initcall level of ffa_init() to rootfs_initcall
  tpm/tpm_svsm: support TPM_CHIP_FLAG_SYNC
  tpm/tpm_ftpm_tee: support TPM_CHIP_FLAG_SYNC
  tpm: support devices with synchronous send()
  tpm: add bufsiz parameter in the .send callback
</content>
</entry>
<entry>
<title>tpm: support devices with synchronous send()</title>
<updated>2025-07-22T23:23:18+00:00</updated>
<author>
<name>Stefano Garzarella</name>
<email>sgarzare@redhat.com</email>
</author>
<published>2025-06-20T13:08:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=04fe47015d7726b42c34615c124697c7a3537bf0'/>
<id>urn:sha1:04fe47015d7726b42c34615c124697c7a3537bf0</id>
<content type='text'>
Some devices do not support interrupts and provide a single synchronous
operation to send the command and receive the response on the same buffer.

Currently, these types of drivers must use an internal buffer where they
temporarily store the response between .send() and .recv() calls.

Introduce a new flag (TPM_CHIP_FLAG_SYNC) to support synchronous send().
If that flag is set by the driver, tpm_try_transmit() will use the send()
callback to send the command and receive the response on the same buffer
synchronously. In that case send() return the number of bytes of the
response on success, or -errno on failure.

Signed-off-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Suggested-by: Jason Gunthorpe &lt;jgg@ziepe.ca&gt;
Suggested-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Reviewed-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
</content>
</entry>
<entry>
<title>tpm: add bufsiz parameter in the .send callback</title>
<updated>2025-07-22T23:23:18+00:00</updated>
<author>
<name>Stefano Garzarella</name>
<email>sgarzare@redhat.com</email>
</author>
<published>2025-06-20T13:08:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=07d8004d6fb95cbe48918e56012f16454cfdfe89'/>
<id>urn:sha1:07d8004d6fb95cbe48918e56012f16454cfdfe89</id>
<content type='text'>
Add a new `bufsiz` parameter to the `.send` callback in `tpm_class_ops`.
This parameter will allow drivers to differentiate between the actual
command length to send and the total buffer size. Currently `bufsiz` is
not used, but it will be used to implement devices with synchronous send()
to send the command and receive the response on the same buffer.

Also rename the previous parameter `len` to `cmd_len` in the declaration
to make it clear that it contains the length in bytes of the command
stored in the buffer. The semantics don't change and it can be used as
before by drivers. This is an optimization since the drivers could get it
from the header, but let's avoid duplicating code.

While we are here, resolve a checkpatch warning:
  WARNING: Unnecessary space before function pointer arguments
  #66: FILE: include/linux/tpm.h:90:
  +	int (*send) (struct tpm_chip *chip, u8 *buf, size_t bufsiz,

Signed-off-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Suggested-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Reviewed-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
</content>
</entry>
<entry>
<title>tpm: don't bother with removal of files in directory we'll be removing</title>
<updated>2025-06-17T22:11:01+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2025-06-11T23:40:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f42b8d78dee77107245ec5beee3eb01915bcae7f'/>
<id>urn:sha1:f42b8d78dee77107245ec5beee3eb01915bcae7f</id>
<content type='text'>
FWIW, there is a reliable indication of removal - -&gt;i_nlink going to 0 ;-)

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>tpm: tis: Double the timeout B to 4s</title>
<updated>2025-05-15T01:49:15+00:00</updated>
<author>
<name>Michal Suchanek</name>
<email>msuchanek@suse.de</email>
</author>
<published>2025-04-04T08:23:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2f661f71fda1fc0c42b7746ca5b7da529eb6b5be'/>
<id>urn:sha1:2f661f71fda1fc0c42b7746ca5b7da529eb6b5be</id>
<content type='text'>
With some Infineon chips the timeouts in tpm_tis_send_data (both B and
C) can reach up to about 2250 ms.

Timeout C is retried since
commit de9e33df7762 ("tpm, tpm_tis: Workaround failed command reception on Infineon devices")

Timeout B still needs to be extended.

The problem is most commonly encountered with context related operation
such as load context/save context. These are issued directly by the
kernel, and there is no retry logic for them.

When a filesystem is set up to use the TPM for unlocking the boot fails,
and restarting the userspace service is ineffective. This is likely
because ignoring a load context/save context result puts the real TPM
state and the TPM state expected by the kernel out of sync.

Chips known to be affected:
tpm_tis IFX1522:00: 2.0 TPM (device-id 0x1D, rev-id 54)
Description: SLB9672
Firmware Revision: 15.22

tpm_tis MSFT0101:00: 2.0 TPM (device-id 0x1B, rev-id 22)
Firmware Revision: 7.83

tpm_tis MSFT0101:00: 2.0 TPM (device-id 0x1A, rev-id 16)
Firmware Revision: 5.63

Link: https://lore.kernel.org/linux-integrity/Z5pI07m0Muapyu9w@kitsune.suse.cz/
Signed-off-by: Michal Suchanek &lt;msuchanek@suse.de&gt;
Reviewed-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
</content>
</entry>
<entry>
<title>tpm: Mask TPM RC in tpm2_start_auth_session()</title>
<updated>2025-05-15T01:47:14+00:00</updated>
<author>
<name>Jarkko Sakkinen</name>
<email>jarkko@kernel.org</email>
</author>
<published>2025-04-07T12:28:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=539fbab37881e32ba6a708a100de6db19e1e7e7d'/>
<id>urn:sha1:539fbab37881e32ba6a708a100de6db19e1e7e7d</id>
<content type='text'>
tpm2_start_auth_session() does not mask TPM RC correctly from the callers:

[   28.766528] tpm tpm0: A TPM error (2307) occurred start auth session

Process TPM RCs inside tpm2_start_auth_session(), and map them to POSIX
error codes.

Cc: stable@vger.kernel.org # v6.10+
Fixes: 699e3efd6c64 ("tpm: Add HMAC session start and end functions")
Reported-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Closes: https://lore.kernel.org/linux-integrity/Z_NgdRHuTKP6JK--@gondor.apana.org.au/
Reviewed-by: Stefano Garzarella &lt;sgarzare@redhat.com&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
</content>
</entry>
<entry>
<title>tpm, tpm_tis: Workaround failed command reception on Infineon devices</title>
<updated>2025-03-27T13:34:05+00:00</updated>
<author>
<name>Jonathan McDowell</name>
<email>noodles@meta.com</email>
</author>
<published>2025-03-12T05:26:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=de9e33df7762abbfc2a1568291f2c3a3154c6a9d'/>
<id>urn:sha1:de9e33df7762abbfc2a1568291f2c3a3154c6a9d</id>
<content type='text'>
Some Infineon devices have a issue where the status register will get
stuck with a quick REQUEST_USE / COMMAND_READY sequence. This is not
simply a matter of requiring a longer timeout; the work around is to
retry the command submission. Add appropriate logic to do this in the
send path.

This is fixed in later firmware revisions, but those are not always
available, and cannot generally be easily updated from outside a
firmware environment.

Testing has been performed with a simple repeated loop of doing a
TPM2_CC_GET_CAPABILITY for TPM_CAP_PROP_MANUFACTURER using the Go code
at:

  https://the.earth.li/~noodles/tpm-stuff/timeout-reproducer-simple.go

It can take several hours to reproduce, and several million operations.

Signed-off-by: Jonathan McDowell &lt;noodles@meta.com&gt;
Reviewed-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
</content>
</entry>
</feed>
