linux/security/keys
Jarkko Sakkinen 3d9e043dab tpm-buf: Memory-safe allocations
Decouple kzalloc from buffer creation, so that a managed allocation can be
used:

	struct tpm_buf *buf __free(kfree) buf = kzalloc(TPM_BUFSIZE,
						GFP_KERNEL);
	if (!buf)
		return -ENOMEM;

	tpm_buf_init(buf, TPM_BUFSIZE);

Alternatively, other allocations are also possible (static data, stack,
etc) for example:

	u8 buf_data[512];
	struct tpm_buf *buf = (struct tpm_buf *)buf_data;
	tpm_buf_init(buf, sizeof(buf_data));

This is achieved by embedding buffer's header inside the allocated blob,
instead of having an outer wrapper.

Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@opinsys.com>
Tested-by: Srish Srinivasan <ssrish@linux.ibm.com>
Message-ID: <20260522013555.1063716-1-jarkko@kernel.org>
Signed-off-by: Ross Philipson <ross.philipson@oracle.com>
2026-08-25 18:13:36 +03:00
..
encrypted-keys keys: Replace strcpy(derived_buf, "AUTH_KEY") with strscpy(..., HASH_SIZE) 2026-06-15 15:19:13 +03:00
trusted-keys tpm-buf: Memory-safe allocations 2026-08-25 18:13:36 +03:00
big_key.c mm: update shmem_[kernel]_file_*() functions to use vma_flags_t 2026-02-12 15:42:58 -08:00
compat_dh.c
compat.c security/keys: remove compat_keyctl_instantiate_key_iov 2020-10-03 00:02:16 -04:00
dh.c KEYS: DH: Use crypto_wait_req 2023-02-13 18:34:48 +08:00
gc.c KEYS: Invert FINAL_PUT bit 2025-06-11 11:57:14 -07:00
internal.h keys: Pin request_key_auth payload in instantiate paths 2026-06-15 15:19:13 +03:00
Kconfig KEYS: encrypted: Remove unnecessary selection of CRYPTO_RNG 2026-06-15 15:19:12 +03:00
key.c keys: prevent slab cache merging for key_jar 2026-06-15 15:19:13 +03:00
keyctl_pkey.c keys: keyctl_pkey: replace BUG with return -EOPNOTSUPP 2026-06-15 15:19:13 +03:00
keyctl.c keys: Pin request_key_auth payload in instantiate paths 2026-06-15 15:19:13 +03:00
keyring.c keys: make keyring key-chunk byte order agree with keyring_diff_objects() 2026-07-23 18:23:39 +03:00
Makefile
permission.c keys: Make the KEY_NEED_* perms an enum rather than a mask 2020-05-19 15:42:22 +01:00
persistent.c
proc.c keys, dns: Allow key types (eg. DNS) to be reclaimed immediately on expiry 2023-12-21 13:47:38 +00:00
process_keys.c cred: make init_cred static 2025-11-04 12:36:02 +01:00
request_key_auth.c keys: Pin request_key_auth payload in instantiate paths 2026-06-15 15:19:13 +03:00
request_key.c keys: request_key: replace BUG with return -EINVAL 2026-06-15 15:19:13 +03:00
sysctl.c treewide: const qualify ctl_tables where applicable 2025-01-28 13:48:37 +01:00
user_defined.c keys: use kmalloc_flex in user_preparse 2026-06-15 15:19:12 +03:00