FAILED: patch "[PATCH] tpm: fix off-by-four bounds check in tpm2_get_random()" failed to apply to 7.2-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 7.2-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.2.y
git checkout FETCH_HEAD
git cherry-pick -x 9b522400bf5c082feb9a0037a053ea822a2c7e4d
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026100307-vacancy-udder-83a1@gregkh' --subject-prefix 'PATCH 7.2.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 9b522400bf5c082feb9a0037a053ea822a2c7e4d Mon Sep 17 00:00:00 2001
From: Jiangshan Yi <[email protected]>
Date: Thu, 3 Sep 2026 11:58:37 +0800
Subject: [PATCH] tpm: fix off-by-four bounds check in tpm2_get_random()
When the response carries the TPM2_ST_SESSIONS tag, tpm2_get_random() skips the 4-byte parameter size field before locating the random data, but the bounds check still validates the response length against TPM_HEADER_SIZE. A truncated response can pass the check and make memcpy() read up to 4 bytes past the response end, so stale buffer contents end up in the caller's random bytes.
Fix this by checking the response length against 'offset', which already includes the skipped parameter size field.
drivers/char/tpm/tpm2-cmd.c +1 -1
@@ -307,7 +307,7 @@ int tpm2_get_random(struct tpm_chip *chip, u8 *dest, size_t max) out = (struct tpm2_get_random_out *)&buf->data[offset]; recd =min_t (u32,be16_to_cpu (out->size), num_bytes);if (tpm_buf_length (buf) < -TPM_HEADER_SIZE + + offset + offsetof(struct tpm2_get_random_out , buffer) + recd) {tpm2_end_auth_session (chip);
Sasha Levin
maintainerPATCH 1/8 tpm: Initial step to reorganize TPM public headers
From: Ross Philipson <[email protected]>
[ Upstream commit e06f28d32f31206c0be32a08b0273e26cfc1fc92 ]
Consolidate TPM1 constants in tpm_command.h and remove duplicate constants from tpm1-cmd.c.
Stable-dep-of: 9b522400bf5c ("tpm: fix off-by-four bounds check in tpm2_get_random()")
--- drivers/char/tpm/tpm-buf.c | 1 - drivers/char/tpm/tpm1-cmd.c | 14 +------- include/keys/trusted_tpm.h | 1 - include/linux/tpm.h | 2 ++ include/linux/tpm_command.h | 41 ++++++++++++++++------- security/keys/trusted-keys/trusted_tpm1.c | 1 - security/keys/trusted-keys/trusted_tpm2.c | 1 - 7 files changed, 31 insertions(+), 30 deletions(-)
drivers/char/tpm/tpm-buf.c +0 -1
@@ -3,7 +3,6 @@* Handling of TPM command and other buffers. */ -#include <linux/tpm_command.h> #include <linux/module.h> #include <linux/tpm.h>
drivers/char/tpm/tpm1-cmd.c +1 -13
@@ -22,8 +22,6 @@#include "tpm.h" -#define TPM_MAX_ORDINAL 243 -/* * Array with one entry per ordinal defining the maximum amount * of time the chip could take to return the result. The ordinal
@@ -308,9 +306,6 @@ unsigned long tpm1_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal)return duration; } -#define TPM_ORD_STARTUP 153 -#define TPM_ST_CLEAR 1 -/** * tpm1_startup() - turn on the TPM * @chip: TPM chip to use
@@ -459,7 +454,6 @@ int tpm1_get_timeouts(struct tpm_chip *chip)return 0 ; } -#define TPM_ORD_PCR_EXTEND 20int tpm1_pcr_extend (struct tpm_chip *chip,u32 pcr_idx,const u8 *hash,const char *log_msg) {
@@ -478,7 +472,6 @@ int tpm1_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, const u8 *hash,return rc; } -#define TPM_ORD_GET_CAP 101ssize_t tpm1_getcap (struct tpm_chip *chip,u32 subcap_id,cap_t *cap,const char *desc,size_t min_cap_length) {
@@ -511,7 +504,6 @@ ssize_t tpm1_getcap(struct tpm_chip *chip, u32 subcap_id, cap_t *cap, }EXPORT_SYMBOL_GPL (tpm1_getcap); -#define TPM_ORD_GET_RANDOM 70struct tpm1_get_random_out {__be32 rng_data_len;u8 rng_data[TPM_MAX_RNG_DATA ];
@@ -580,13 +572,12 @@ int tpm1_get_random(struct tpm_chip *chip, u8 *dest, size_t max)return rc; } -#define TPM_ORD_PCRREAD 21int tpm1_pcr_read (struct tpm_chip *chip,u32 pcr_idx,u8 *res_buf) {struct tpm_buf buf;int rc; - rc =tpm_buf_init (&buf,TPM_TAG_RQU_COMMAND ,TPM_ORD_PCRREAD ); + rc =tpm_buf_init (&buf,TPM_TAG_RQU_COMMAND ,TPM_ORD_PCR_READ );if (rc)return rc;
@@ -609,7 +600,6 @@ int tpm1_pcr_read(struct tpm_chip *chip, u32 pcr_idx, u8 *res_buf)return rc; } -#define TPM_ORD_CONTINUE_SELFTEST 83/** * tpm1_continue_selftest() - run TPM's selftest * @chip: TPM chip to use
@@ -726,8 +716,6 @@ int tpm1_auto_startup(struct tpm_chip *chip)return rc; } -#define TPM_ORD_SAVESTATE 152 -/** * tpm1_pm_suspend() - pm suspend handler * @chip: TPM chip to use.
include/keys/trusted_tpm.h +0 -1
@@ -3,7 +3,6 @@#define __TRUSTED_TPM_H#include <keys/trusted-type.h> -#include <linux/tpm_command.h> extern struct trusted_key_ops trusted_key_tpm_ops;
include/linux/tpm.h +2 -0
@@ -25,6 +25,8 @@#include <crypto/hash_info.h> #include <crypto/aes.h> +#include <linux/tpm_command.h> +#define TPM_DIGEST_SIZE 20/* Max TPM v1.2 PCR size */ #define TPM2_MAX_DIGEST_SIZE SHA512_DIGEST_SIZE
include/linux/tpm_command.h +28 -13
55 lines not on this page · raw message
security/keys/trusted-keys/trusted_tpm1.c +0 -1
@@ -18,7 +18,6 @@#include <keys/trusted-type.h> #include <linux/key-type.h> #include <linux/tpm.h> -#include <linux/tpm_command.h> #include <keys/trusted_tpm.h>
security/keys/trusted-keys/trusted_tpm2.c +0 -1
@@ -9,7 +9,6 @@#include <linux/string.h> #include <linux/err.h> #include <linux/tpm.h> -#include <linux/tpm_command.h> #include <keys/trusted-type.h> #include <keys/trusted_tpm.h>
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/8 tpm: Move TPM1 specific definitions to the command header
From: Ross Philipson <[email protected]>
[ Upstream commit 94d48062eb9626244f6ddb5a682cdaae40540030 ]
Gather all the TPM1 definitions and structures from the internal header file drivers/char/tpm/tpm.h into the command header. In addition, bring in the single RNG structure from tpm1-cmd.c.
The definitions moved to these files correspond to the TCG specification for TPM 1 family:
TPM 1.2 Main Specification
- https://trustedcomputinggroup.org/resource/tpm-main-specification/
Stable-dep-of: 9b522400bf5c ("tpm: fix off-by-four bounds check in tpm2_get_random()")
--- drivers/char/tpm/tpm.h | 102 -------------------------------- drivers/char/tpm/tpm1-cmd.c | 5 -- include/linux/tpm_command.h | 115 ++++++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+), 107 deletions(-)
drivers/char/tpm/tpm.h +0 -102
@@ -52,105 +52,9 @@ enum tpm_addr { TPM_ADDR = 0x4E, }; -#define TPM_WARN_RETRY 0x800 -#define TPM_WARN_DOING_SELFTEST 0x802 -#define TPM_ERR_DEACTIVATED 0x6 -#define TPM_ERR_DISABLED 0x7 -#define TPM_ERR_FAILEDSELFTEST 0x1C -#define TPM_ERR_INVALID_POSTINIT 38 - -#define TPM_TAG_RQU_COMMAND 193 -/* TPM2 specific constants. */ #define TPM2_SPACE_BUFFER_SIZE 16384/* 16 kB */ -struct stclear_flags_t { -__be16 tag; -u8 deactivated; -u8 disableForceClear; -u8 physicalPresence; -u8 physicalPresenceLock; -u8 bGlobalLock; -} __packed; - -struct tpm1_version { -u8 major; -u8 minor; -u8 rev_major; -u8 rev_minor; -} __packed; - -struct tpm1_version2 { -__be16 tag; -struct tpm1_version version; -} __packed; - -struct timeout_t { -__be32 a; -__be32 b; -__be32 c; -__be32 d; -} __packed; - -struct duration_t { -__be32 tpm_short; -__be32 tpm_medium; -__be32 tpm_long; -} __packed; - -struct permanent_flags_t { -__be16 tag; -u8 disable; -u8 ownership; -u8 deactivated; -u8 readPubek; -u8 disableOwnerClear; -u8 allowMaintenance; -u8 physicalPresenceLifetimeLock; -u8 physicalPresenceHWEnable; -u8 physicalPresenceCMDEnable; -u8 CEKPUsed; -u8 TPMpost; -u8 TPMpostLock; -u8 FIPS; -u8 operator; -u8 enableRevokeEK; -u8 nvLocked; -u8 readSRKPub; -u8 tpmEstablished; -u8 maintenanceDone; -u8 disableFullDALogicInfo; -} __packed; - -typedef union { -struct permanent_flags_t perm_flags; -struct stclear_flags_t stclear_flags; -__u8 owned; -__be32 num_pcrs; -struct tpm1_version version1; -struct tpm1_version2 version2; -__be32 manufacturer_id; -struct timeout_t timeout; -struct duration_t duration; -}cap_t ; - -enum tpm_capabilities { -TPM_CAP_FLAG =4 , -TPM_CAP_PROP =5 , -TPM_CAP_VERSION_1_1 =0x06 , -TPM_CAP_VERSION_1_2 =0x1A , -}; - -enum tpm_sub_capabilities { -TPM_CAP_PROP_PCR =0x101 , -TPM_CAP_PROP_MANUFACTURER =0x103 , -TPM_CAP_FLAG_PERM =0x108 , -TPM_CAP_FLAG_VOL =0x109 , -TPM_CAP_PROP_OWNER =0x111 , -TPM_CAP_PROP_TIS_TIMEOUT =0x115 , -TPM_CAP_PROP_TIS_DURATION =0x120 , -}; -enum tpm2_pt_props {TPM2_PT_NONE =0x00000000 ,TPM2_PT_GROUP =0x00000100 ,
@@ -225,12 +129,6 @@ enum tpm2_pt_props { TPM2_PT_AUDIT_COUNTER_1 = TPM2_PT_VAR + 20, }; -/* 128 bytes is an arbitrary cap. This could be as large as TPM_BUFSIZE - 18 -* bytes, but 128 is still a relatively large number of random bytes and -* anything much bigger causes users of struct tpm_cmd_t to start getting -* compiler warnings about stack frame size. */ -#define TPM_MAX_RNG_DATA 128 -extern const struct class tpm_class;extern const struct class tpmrm_class;extern dev_t tpm_devt;
drivers/char/tpm/tpm1-cmd.c +0 -5
@@ -504,11 +504,6 @@ ssize_t tpm1_getcap(struct tpm_chip *chip, u32 subcap_id, cap_t *cap, }EXPORT_SYMBOL_GPL (tpm1_getcap); -struct tpm1_get_random_out { -__be32 rng_data_len; -u8 rng_data[TPM_MAX_RNG_DATA ]; -} __packed; -/** * tpm1_get_random() - get random bytes from the TPM's RNG * @chip: a &struct tpm_chip instance
include/linux/tpm_command.h +115 -0
121 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/8 tpm: Move TPM2 specific definitions to the command header
In reply to Sasha LevinFrom: Ross Philipson <[email protected]>
[ Upstream commit 7a5ec92813bc794ab3674aab993fe8f8b5cee9f0 ]
Gather all the TPM2 definitions and structures in the internal header file drivers/char/tpm/tpm.h into the command header, including:
- Command codes, return codes and definitions from the public and
internal tpm.h files.
- Structures defined in numerous TPM driver C modules.
The definitions moved to these files correspond to the TCG specification for TPM 2 family:
TPM 2.0 Library
- https://trustedcomputinggroup.org/resource/tpm-library-specification/
Stable-dep-of: 9b522400bf5c ("tpm: fix off-by-four bounds check in tpm2_get_random()")
--- drivers/char/tpm/tpm.h | 77 ---------- drivers/char/tpm/tpm2-cmd.c | 30 ---- drivers/char/tpm/tpm2-space.c | 13 -- include/linux/tpm.h | 145 ------------------ include/linux/tpm_command.h | 271 ++++++++++++++++++++++++++++++++++ 5 files changed, 271 insertions(+), 265 deletions(-)
drivers/char/tpm/tpm.h +0 -77
@@ -52,83 +52,6 @@ enum tpm_addr { TPM_ADDR = 0x4E, }; -/* TPM2 specific constants. */ -#define TPM2_SPACE_BUFFER_SIZE 16384/* 16 kB */ - -enum tpm2_pt_props { -TPM2_PT_NONE =0x00000000 , -TPM2_PT_GROUP =0x00000100 , -TPM2_PT_FIXED =TPM2_PT_GROUP *1 , -TPM2_PT_FAMILY_INDICATOR =TPM2_PT_FIXED +0 , -TPM2_PT_LEVEL =TPM2_PT_FIXED +1 , -TPM2_PT_REVISION =TPM2_PT_FIXED +2 , -TPM2_PT_DAY_OF_YEAR =TPM2_PT_FIXED +3 , -TPM2_PT_YEAR =TPM2_PT_FIXED +4 , -TPM2_PT_MANUFACTURER =TPM2_PT_FIXED +5 , -TPM2_PT_VENDOR_STRING_1 =TPM2_PT_FIXED +6 , -TPM2_PT_VENDOR_STRING_2 =TPM2_PT_FIXED +7 , -TPM2_PT_VENDOR_STRING_3 =TPM2_PT_FIXED +8 , -TPM2_PT_VENDOR_STRING_4 =TPM2_PT_FIXED +9 , -TPM2_PT_VENDOR_TPM_TYPE =TPM2_PT_FIXED +10 , -TPM2_PT_FIRMWARE_VERSION_1 =TPM2_PT_FIXED +11 , -TPM2_PT_FIRMWARE_VERSION_2 =TPM2_PT_FIXED +12 , -TPM2_PT_INPUT_BUFFER =TPM2_PT_FIXED +13 , -TPM2_PT_HR_TRANSIENT_MIN =TPM2_PT_FIXED +14 , -TPM2_PT_HR_PERSISTENT_MIN =TPM2_PT_FIXED +15 , -TPM2_PT_HR_LOADED_MIN =TPM2_PT_FIXED +16 , -TPM2_PT_ACTIVE_SESSIONS_MAX =TPM2_PT_FIXED +17 , -TPM2_PT_PCR_COUNT =TPM2_PT_FIXED +18 , -TPM2_PT_PCR_SELECT_MIN =TPM2_PT_FIXED +19 , -TPM2_PT_CONTEXT_GAP_MAX =TPM2_PT_FIXED +20 , -TPM2_PT_NV_COUNTERS_MAX =TPM2_PT_FIXED +22 , -TPM2_PT_NV_INDEX_MAX =TPM2_PT_FIXED +23 , -TPM2_PT_MEMORY =TPM2_PT_FIXED +24 , -TPM2_PT_CLOCK_UPDATE =TPM2_PT_FIXED +25 , -TPM2_PT_CONTEXT_HASH =TPM2_PT_FIXED +26 , -TPM2_PT_CONTEXT_SYM =TPM2_PT_FIXED +27 , -TPM2_PT_CONTEXT_SYM_SIZE =TPM2_PT_FIXED +28 , -TPM2_PT_ORDERLY_COUNT =TPM2_PT_FIXED +29 , -TPM2_PT_MAX_COMMAND_SIZE =TPM2_PT_FIXED +30 , -TPM2_PT_MAX_RESPONSE_SIZE =TPM2_PT_FIXED +31 , -TPM2_PT_MAX_DIGEST =TPM2_PT_FIXED +32 , -TPM2_PT_MAX_OBJECT_CONTEXT =TPM2_PT_FIXED +33 , -TPM2_PT_MAX_SESSION_CONTEXT =TPM2_PT_FIXED +34 , -TPM2_PT_PS_FAMILY_INDICATOR =TPM2_PT_FIXED +35 , -TPM2_PT_PS_LEVEL =TPM2_PT_FIXED +36 , -TPM2_PT_PS_REVISION =TPM2_PT_FIXED +37 , -TPM2_PT_PS_DAY_OF_YEAR =TPM2_PT_FIXED +38 , -TPM2_PT_PS_YEAR =TPM2_PT_FIXED +39 , -TPM2_PT_SPLIT_MAX =TPM2_PT_FIXED +40 , -TPM2_PT_TOTAL_COMMANDS =TPM2_PT_FIXED +41 , -TPM2_PT_LIBRARY_COMMANDS =TPM2_PT_FIXED +42 , -TPM2_PT_VENDOR_COMMANDS =TPM2_PT_FIXED +43 , -TPM2_PT_NV_BUFFER_MAX =TPM2_PT_FIXED +44 , -TPM2_PT_MODES =TPM2_PT_FIXED +45 , -TPM2_PT_MAX_CAP_BUFFER =TPM2_PT_FIXED +46 , -TPM2_PT_VAR =TPM2_PT_GROUP *2 , -TPM2_PT_PERMANENT =TPM2_PT_VAR +0 , -TPM2_PT_STARTUP_CLEAR =TPM2_PT_VAR +1 , -TPM2_PT_HR_NV_INDEX =TPM2_PT_VAR +2 , -TPM2_PT_HR_LOADED =TPM2_PT_VAR +3 , -TPM2_PT_HR_LOADED_AVAIL =TPM2_PT_VAR +4 , -TPM2_PT_HR_ACTIVE =TPM2_PT_VAR +5 , -TPM2_PT_HR_ACTIVE_AVAIL =TPM2_PT_VAR +6 , -TPM2_PT_HR_TRANSIENT_AVAIL =TPM2_PT_VAR +7 , -TPM2_PT_HR_PERSISTENT =TPM2_PT_VAR +8 , -TPM2_PT_HR_PERSISTENT_AVAIL =TPM2_PT_VAR +9 , -TPM2_PT_NV_COUNTERS =TPM2_PT_VAR +10 , -TPM2_PT_NV_COUNTERS_AVAIL =TPM2_PT_VAR +11 , -TPM2_PT_ALGORITHM_SET =TPM2_PT_VAR +12 , -TPM2_PT_LOADED_CURVES =TPM2_PT_VAR +13 , -TPM2_PT_LOCKOUT_COUNTER =TPM2_PT_VAR +14 , -TPM2_PT_MAX_AUTH_FAIL =TPM2_PT_VAR +15 , -TPM2_PT_LOCKOUT_INTERVAL =TPM2_PT_VAR +16 , -TPM2_PT_LOCKOUT_RECOVERY =TPM2_PT_VAR +17 , -TPM2_PT_NV_WRITE_RECOVERY =TPM2_PT_VAR +18 , -TPM2_PT_AUDIT_COUNTER_0 =TPM2_PT_VAR +19 , -TPM2_PT_AUDIT_COUNTER_1 =TPM2_PT_VAR +20 , -}; -extern const struct class tpm_class;extern const struct class tpmrm_class;extern dev_t tpm_devt;
drivers/char/tpm/tpm2-cmd.c +0 -30
@@ -94,17 +94,6 @@ unsigned long tpm2_calc_ordinal_duration(u32 ordinal)return msecs_to_jiffies (TPM2_DURATION_DEFAULT ); } -struct tpm2_pcr_read_out { -__be32 update_cnt; -__be32 pcr_selects_cnt; -__be16 hash_alg; -u8 pcr_select_size; -u8 pcr_select[TPM2_PCR_SELECT_MIN ]; -__be32 digests_cnt; -__be16 digest_size; -u8 digest[]; -} __packed; -/** * tpm2_pcr_read() - read a PCR value * @chip: TPM chip to use.
@@ -238,11 +227,6 @@ int tpm2_pcr_extend(struct tpm_chip *chip, u32 pcr_idx,return rc; } -struct tpm2_get_random_out { -__be16 size; -u8 buffer[TPM_MAX_RNG_DATA ]; -} __packed; -/** * tpm2_get_random() - get random bytes from the TPM RNG *
@@ -364,14 +348,6 @@ void tpm2_flush_context(struct tpm_chip *chip, u32 handle) }EXPORT_SYMBOL_GPL (tpm2_flush_context); -struct tpm2_get_cap_out { -u8 more_data; -__be32 subcap_id; -__be32 property_cnt; -__be32 property_id; -__be32 value; -} __packed; -/** * tpm2_get_tpm_pt() - get value of a TPM_CAP_TPM_PROPERTIES type property * @chip: a &tpm_chip instance
@@ -539,12 +515,6 @@ static int tpm2_init_bank_info(struct tpm_chip *chip, u32 bank_index)return tpm2_pcr_read (chip,0 , &digest, &bank->digest_size); } -struct tpm2_pcr_selection { -__be16 hash_alg; -u8 size_of_select; -u8 pcr_select[3 ]; -} __packed; -ssize_t tpm2_get_pcr_allocation (struct tpm_chip *chip) {struct tpm2_pcr_selection pcr_selection;
drivers/char/tpm/tpm2-space.c +0 -13
@@ -15,19 +15,6 @@#include <linux/unaligned.h> #include "tpm.h" -enum tpm2_handle_types { -TPM2_HT_HMAC_SESSION =0x02000000 , -TPM2_HT_POLICY_SESSION =0x03000000 , -TPM2_HT_TRANSIENT =0x80000000 , -}; - -struct tpm2_context { -__be64 sequence; -__be32 saved_handle; -__be32 hierarchy; -__be16 blob_size; -} __packed; -static void tpm2_flush_sessions (struct tpm_chip *chip,struct tpm_space *space) {int i;
include/linux/tpm.h +0 -145
174 lines not on this page · raw message
include/linux/tpm_command.h +271 -0
275 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 4/8 tpm: Move TPM common base definitions to the command header
In reply to Sasha LevinFrom: Ross Philipson <[email protected]>
[ Upstream commit 88c5a62c3af7ca6f36dc6ffc52bcfb29cd2990cb ]
These are top level definitions shared by both TPM 1 and 2 family chips. This includes core definitions like TPM localities, common crypto algorithm IDs, and the base TPM command header.
Stable-dep-of: 9b522400bf5c ("tpm: fix off-by-four bounds check in tpm2_get_random()")
--- drivers/char/tpm/tpm.h | 1 - include/linux/tpm.h | 50 +------------------- include/linux/tpm_command.h | 91 +++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 50 deletions(-)
drivers/char/tpm/tpm.h +0 -1
@@ -33,7 +33,6 @@#endif #define TPM_MINOR 224/* officially assigned */ -#define TPM_BUFSIZE 4096#define TPM_NUM_DEVICES 65536#define TPM_RETRY 50
include/linux/tpm.h +1 -49
80 lines not on this page · raw message
include/linux/tpm_command.h +91 -0
101 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 5/8 tpm-buf: Merge TPM_BUF_BOUNDARY_ERROR and TPM_BUF_OVERFLOW
In reply to Sasha LevinFrom: Jarkko Sakkinen <[email protected]>
[ Upstream commit 0b9551c189518544b65000a234277298e931c8f3 ]
Merge TPM_BUF_BOUNDARY_ERROR and TPM_BUF_OVERFLOW flags into the TPM_BUF_INVALID flag, as their behavior is identical (the only difference being the associated log messages).
Message-ID: <[email protected]>
Stable-dep-of: 9b522400bf5c ("tpm: fix off-by-four bounds check in tpm2_get_random()")
--- drivers/char/tpm/tpm-buf.c | 10 ++++------ include/linux/tpm.h | 8 +++----- security/keys/trusted-keys/trusted_tpm2.c | 6 +++--- 3 files changed, 10 insertions(+), 14 deletions(-)
drivers/char/tpm/tpm-buf.c +4 -6
@@ -103,13 +103,12 @@ EXPORT_SYMBOL_GPL(tpm_buf_length);*/ void tpm_buf_append (struct tpm_buf *buf,const u8 *new_data,u16 new_length) { -/* Return silently if overflow has already happened. */ -if (buf->flags &TPM_BUF_OVERFLOW ) +if (buf->flags &TPM_BUF_INVALID )return ;if ((buf->length + new_length) >PAGE_SIZE ) {WARN (1 ,"tpm_buf: write overflow\n" ); - buf->flags |=TPM_BUF_OVERFLOW ; + buf->flags |=TPM_BUF_INVALID ;return ; }
@@ -176,14 +175,13 @@ static void tpm_buf_read(struct tpm_buf *buf, off_t *offset, size_t count, void {off_t next_offset; -/* Return silently if overflow has already happened. */ -if (buf->flags &TPM_BUF_BOUNDARY_ERROR ) +if (buf->flags &TPM_BUF_INVALID )return ; next_offset = *offset + count;if (next_offset > buf->length) {WARN (1 ,"tpm_buf: read out of boundary\n" ); - buf->flags |=TPM_BUF_BOUNDARY_ERROR ; + buf->flags |=TPM_BUF_INVALID ;return ; }
include/linux/tpm.h +3 -5
@@ -201,12 +201,10 @@ enum tpm_chip_flags {#define to_tpm_chip (d) container_of(d, struct tpm_chip, dev)enum tpm_buf_flags { -/* the capacity exceeded: */ -TPM_BUF_OVERFLOW =BIT (0 ),/* TPM2B format: */ -TPM_BUF_TPM2B =BIT (1 ), -/* read out of boundary: */ -TPM_BUF_BOUNDARY_ERROR =BIT (2 ), +TPM_BUF_TPM2B =BIT (0 ), +/* The buffer is in invalid and unusable state: */ +TPM_BUF_INVALID =BIT (1 ), };/*
security/keys/trusted-keys/trusted_tpm2.c +3 -3
@@ -313,7 +313,7 @@ int tpm2_seal_trusted(struct tpm_chip *chip,/* creation PCR */ tpm_buf_append_u32 (&buf,0 ); -if (buf.flags &TPM_BUF_OVERFLOW ) { +if (buf.flags &TPM_BUF_INVALID ) { rc = -E2BIG ;tpm2_end_auth_session (chip); goto out;
@@ -329,7 +329,7 @@ int tpm2_seal_trusted(struct tpm_chip *chip, goto out; blob_len =tpm_buf_read_u32 (&buf, &offset); -if (blob_len >MAX_BLOB_SIZE || buf.flags &TPM_BUF_BOUNDARY_ERROR ) { +if (blob_len >MAX_BLOB_SIZE || buf.flags &TPM_BUF_INVALID ) { rc = -E2BIG ; goto out; }
@@ -443,7 +443,7 @@ static int tpm2_load_cmd(struct tpm_chip *chip,tpm_buf_append (&buf, blob, blob_len); -if (buf.flags &TPM_BUF_OVERFLOW ) { +if (buf.flags &TPM_BUF_INVALID ) { rc = -E2BIG ;tpm2_end_auth_session (chip); goto out;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 6/8 tpm-buf: Remove chip parameter from tpm_buf_append_handle()
In reply to Sasha LevinFrom: Jarkko Sakkinen <[email protected]>
[ Upstream commit 065cfba1f4545e5948a2ddc5888a27c7641d5bfc ]
Remove the TPM driver chip parameter from the function tpm_buf_append_handle(). The chip parameter is only for error logging which can be done with other facilities like WARN().
Message-ID: <[email protected]>
Stable-dep-of: 9b522400bf5c ("tpm: fix off-by-four bounds check in tpm2_get_random()")
--- drivers/char/tpm/tpm-buf.c | 9 ++++++--- drivers/char/tpm/tpm2-cmd.c | 2 +- drivers/char/tpm/tpm2-sessions.c | 2 +- include/linux/tpm.h | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-)
drivers/char/tpm/tpm-buf.c +6 -3
@@ -146,17 +146,20 @@ EXPORT_SYMBOL_GPL(tpm_buf_append_u32);/** * tpm_buf_append_handle() - Add a handle -* @chip: &tpm_chip instance * @buf: &tpm_buf instance * @handle: a TPM object handle * * Add a handle to the buffer, and increase the count tracking the number of * handles in the command buffer. Works only for command buffers. */ -void tpm_buf_append_handle (struct tpm_chip *chip,struct tpm_buf *buf,u32 handle) +void tpm_buf_append_handle (struct tpm_buf *buf,u32 handle) { +if (buf->flags &TPM_BUF_INVALID ) +return ; +if (buf->flags &TPM_BUF_TPM2B ) { -dev_err (&chip->dev,"Invalid buffer type (TPM2B)\n" ); +WARN (1 ,"tpm-buf: invalid type: TPM2B\n" ); + buf->flags |=TPM_BUF_INVALID ;return ; }
drivers/char/tpm/tpm2-cmd.c +1 -1
@@ -198,7 +198,7 @@ int tpm2_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, }tpm_buf_append_hmac_session (chip, &buf,0 ,NULL ,0 ); }else { -tpm_buf_append_handle (chip, &buf, pcr_idx); +tpm_buf_append_handle (&buf, pcr_idx);tpm_buf_append_auth (chip, &buf,NULL ,0 ); }
drivers/char/tpm/tpm2-sessions.c +1 -1
@@ -260,7 +260,7 @@ int tpm_buf_append_name(struct tpm_chip *chip, struct tpm_buf *buf,#endif if (!tpm2_chip_auth (chip)) { -tpm_buf_append_handle (chip, buf, handle); +tpm_buf_append_handle (buf, handle);return 0 ; }
include/linux/tpm.h +1 -1
@@ -235,7 +235,7 @@ void tpm_buf_append_u32(struct tpm_buf *buf, const u32 value);u8 tpm_buf_read_u8 (struct tpm_buf *buf,off_t *offset);u16 tpm_buf_read_u16 (struct tpm_buf *buf,off_t *offset);u32 tpm_buf_read_u32 (struct tpm_buf *buf,off_t *offset); -void tpm_buf_append_handle (struct tpm_chip *chip,struct tpm_buf *buf,u32 handle); +void tpm_buf_append_handle (struct tpm_buf *buf,u32 handle);/* * Check if TPM device is in the firmware upgrade mode.
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 7/8 tpm-buf: Memory-safe allocations
In reply to Sasha LevinFrom: Jarkko Sakkinen <[email protected]>
[ Upstream commit 3d9e043dab0a038a53a43570f60bbf4b1e27d63f ]
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.
Message-ID: <[email protected]>
Stable-dep-of: 9b522400bf5c ("tpm: fix off-by-four bounds check in tpm2_get_random()")
--- drivers/char/tpm/tpm-buf.c | 122 +++++---- drivers/char/tpm/tpm-sysfs.c | 26 +- drivers/char/tpm/tpm1-cmd.c | 163 ++++++------ drivers/char/tpm/tpm2-cmd.c | 291 +++++++++++----------- drivers/char/tpm/tpm2-sessions.c | 162 ++++++------ drivers/char/tpm/tpm2-space.c | 44 ++-- drivers/char/tpm/tpm_vtpm_proxy.c | 30 +-- include/linux/tpm.h | 17 +- security/keys/trusted-keys/trusted_tpm1.c | 44 ++-- security/keys/trusted-keys/trusted_tpm2.c | 165 ++++++------ 10 files changed, 530 insertions(+), 534 deletions(-)
drivers/char/tpm/tpm-buf.c +76 -46
@@ -6,82 +6,110 @@#include <linux/module.h> #include <linux/tpm.h> -/** -* tpm_buf_init() - Allocate and initialize a TPM command -* @buf: A &tpm_buf -* @tag: TPM_TAG_RQU_COMMAND, TPM2_ST_NO_SESSIONS or TPM2_ST_SESSIONS -* @ordinal: A command ordinal -* -* Return: 0 or -ENOMEM -*/ -int tpm_buf_init (struct tpm_buf *buf,u16 tag,u32 ordinal) +static void __tpm_buf_size_invariant (struct tpm_buf *buf,u16 buf_size) { - buf->data = (u8 *)__get_free_page (GFP_KERNEL ); -if (!buf->data) -return -ENOMEM ; - -tpm_buf_reset (buf, tag, ordinal); -return 0 ; +u32 buf_size_2 = (u32 )buf->capacity + (u32 )sizeof (*buf); + +if (!buf->capacity) { +if (buf_size >TPM_BUFSIZE ) { +WARN (1 ,"%s: size overflow: %u\n" , __func__, buf_size); + buf->flags |=TPM_BUF_INVALID ; + } + }else { +if (buf_size != buf_size_2) { +WARN (1 ,"%s: size mismatch: %u != %u\n" , __func__, + buf_size, buf_size_2); + buf->flags |=TPM_BUF_INVALID ; + } + } } -EXPORT_SYMBOL_GPL (tpm_buf_init); -/** -* tpm_buf_reset() - Initialize a TPM command -* @buf: A &tpm_buf -* @tag: TPM_TAG_RQU_COMMAND, TPM2_ST_NO_SESSIONS or TPM2_ST_SESSIONS -* @ordinal: A command ordinal -*/ -void tpm_buf_reset (struct tpm_buf *buf,u16 tag,u32 ordinal) +static void __tpm_buf_reset (struct tpm_buf *buf,u16 buf_size,u16 tag, +u32 ordinal) {struct tpm_header *head = (struct tpm_header *)buf->data; +__tpm_buf_size_invariant (buf, buf_size); + +if (buf->flags &TPM_BUF_INVALID ) +return ; +WARN_ON (tag !=TPM_TAG_RQU_COMMAND && tag !=TPM2_ST_NO_SESSIONS && tag !=TPM2_ST_SESSIONS && tag !=0 ); buf->flags =0 ; buf->length =sizeof (*head); + buf->capacity = buf_size -sizeof (*buf); + buf->handles =0 ; head->tag =cpu_to_be16 (tag); head->length =cpu_to_be32 (sizeof (*head)); head->ordinal =cpu_to_be32 (ordinal); +} + +static void __tpm_buf_reset_sized (struct tpm_buf *buf,u16 buf_size) +{ +__tpm_buf_size_invariant (buf, buf_size); + +if (buf->flags &TPM_BUF_INVALID ) +return ; + + buf->flags =TPM_BUF_TPM2B ; + buf->length =2 ; + buf->capacity = buf_size -sizeof (*buf); buf->handles =0 ; + buf->data[0 ] =0 ; + buf->data[1 ] =0 ; } -EXPORT_SYMBOL_GPL (tpm_buf_reset);/** -* tpm_buf_init_sized() - Allocate and initialize a sized (TPM2B) buffer -* @buf: A @tpm_buf -* -* Return: 0 or -ENOMEM +* tpm_buf_init() - Initialize a TPM command +* @buf: A &tpm_buf +* @buf_size: Size of the buffer. */ -int tpm_buf_init_sized (struct tpm_buf *buf) +void tpm_buf_init (struct tpm_buf *buf,u16 buf_size) { - buf->data = (u8 *)__get_free_page (GFP_KERNEL ); -if (!buf->data) -return -ENOMEM ; +memset (buf,0 , buf_size); +__tpm_buf_reset (buf, buf_size,TPM_TAG_RQU_COMMAND ,0 ); +} +EXPORT_SYMBOL_GPL (tpm_buf_init); -tpm_buf_reset_sized (buf); -return 0 ; +/** +* tpm_buf_init_sized() - Initialize a sized buffer +* @buf: A &tpm_buf +* @buf_size: Size of the buffer. +*/ +void tpm_buf_init_sized (struct tpm_buf *buf,u16 buf_size) +{ +memset (buf,0 , buf_size); +__tpm_buf_reset_sized (buf, buf_size); }EXPORT_SYMBOL_GPL (tpm_buf_init_sized);/** -* tpm_buf_reset_sized() - Initialize a sized buffer +* tpm_buf_reset() - Re-initialize a TPM command * @buf: A &tpm_buf +* @tag: TPM_TAG_RQU_COMMAND, TPM2_ST_NO_SESSIONS or TPM2_ST_SESSIONS +* @ordinal: A command ordinal */ -void tpm_buf_reset_sized (struct tpm_buf *buf) +void tpm_buf_reset (struct tpm_buf *buf,u16 tag,u32 ordinal) { - buf->flags =TPM_BUF_TPM2B ; - buf->length =2 ; - buf->data[0 ] =0 ; - buf->data[1 ] =0 ; +u16 buf_size = buf->capacity +sizeof (*buf); + +__tpm_buf_reset (buf, buf_size, tag, ordinal); } -EXPORT_SYMBOL_GPL (tpm_buf_reset_sized); +EXPORT_SYMBOL_GPL (tpm_buf_reset); -void tpm_buf_destroy (struct tpm_buf *buf) +/** +* tpm_buf_reset_sized() - Re-initialize a sized buffer +* @buf: A &tpm_buf +*/ +void tpm_buf_reset_sized (struct tpm_buf *buf) { -free_page ((unsigned long )buf->data); +u16 buf_size = buf->capacity +sizeof (*buf); + +__tpm_buf_reset_sized (buf, buf_size); } -EXPORT_SYMBOL_GPL (tpm_buf_destroy); +EXPORT_SYMBOL_GPL (tpm_buf_reset_sized);/** * tpm_buf_length() - Return the number of bytes consumed by the data
@@ -89,7 +117,7 @@ EXPORT_SYMBOL_GPL(tpm_buf_destroy);* * Return: The number of bytes consumed by the buffer */ -u32 tpm_buf_length (struct tpm_buf *buf) +u16 tpm_buf_length (struct tpm_buf *buf) {return buf->length; }
@@ -103,10 +131,12 @@ EXPORT_SYMBOL_GPL(tpm_buf_length);*/ void tpm_buf_append (struct tpm_buf *buf,const u8 *new_data,u16 new_length) { +u32 total_length = (u32 )buf->length + (u32 )new_length; +if (buf->flags &TPM_BUF_INVALID )return ; -if ((buf->length + new_length) >PAGE_SIZE ) { +if (total_length > (u32 )buf->capacity) {WARN (1 ,"tpm_buf: write overflow\n" ); buf->flags |=TPM_BUF_INVALID ;return ;
drivers/char/tpm/tpm-sysfs.c +15 -11
@@ -32,28 +32,35 @@ struct tpm_readpubek_out {static ssize_t pubek_show (struct device *dev,struct device_attribute *attr,char *buf) { -struct tpm_buf tpm_buf;struct tpm_readpubek_out *out;int i;char *str = buf;struct tpm_chip *chip =to_tpm_chip (dev);char anti_replay[20 ]; + struct tpm_buf *tpm_buf __free(kfree) = NULL;memset (&anti_replay,0 ,sizeof (anti_replay));if (tpm_try_get_ops (chip))return 0 ; -if (tpm_buf_init (&tpm_buf,TPM_TAG_RQU_COMMAND ,TPM_ORD_READPUBEK )) - goto out_ops; + tpm_buf =kzalloc (TPM_BUFSIZE ,GFP_KERNEL ); +if (!tpm_buf) { +tpm_put_ops (chip); +return 0 ; + } -tpm_buf_append (&tpm_buf, anti_replay,sizeof (anti_replay)); +tpm_buf_init (tpm_buf,TPM_BUFSIZE ); +tpm_buf_reset (tpm_buf,TPM_TAG_RQU_COMMAND ,TPM_ORD_READPUBEK ); +tpm_buf_append (tpm_buf, anti_replay,sizeof (anti_replay)); -if (tpm_transmit_cmd (chip, &tpm_buf,READ_PUBEK_RESULT_MIN_BODY_SIZE , -"attempting to read the PUBEK" )) - goto out_buf; +if (tpm_transmit_cmd (chip, tpm_buf,READ_PUBEK_RESULT_MIN_BODY_SIZE , +"attempting to read the PUBEK" )) { +tpm_put_ops (chip); +return 0 ; + } - out = (struct tpm_readpubek_out *)&tpm_buf.data[10 ]; + out = (struct tpm_readpubek_out *)&tpm_buf->data[10 ]; str +=sprintf (str, "Algorithm: %4ph\n"
@@ -71,9 +78,6 @@ static ssize_t pubek_show(struct device *dev, struct device_attribute *attr,for (i =0 ; i <256 ; i +=16 ) str +=sprintf (str,"%16ph\n" , &out->modulus[i]); -out_buf: -tpm_buf_destroy (&tpm_buf); -out_ops:tpm_put_ops (chip);return str - buf; }
drivers/char/tpm/tpm1-cmd.c +77 -86
280 lines not on this page · raw message
drivers/char/tpm/tpm2-cmd.c +142 -149
545 lines not on this page · raw message
drivers/char/tpm/tpm2-sessions.c +77 -85
295 lines not on this page · raw message
drivers/char/tpm/tpm2-space.c +18 -26
106 lines not on this page · raw message
drivers/char/tpm/tpm_vtpm_proxy.c +13 -17
@@ -395,40 +395,36 @@ static bool vtpm_proxy_tpm_req_canceled(struct tpm_chip *chip, u8 status)static int vtpm_proxy_request_locality (struct tpm_chip *chip,int locality) { -struct tpm_buf buf;int rc;const struct tpm_header *header;struct proxy_dev *proxy_dev =dev_get_drvdata (&chip->dev); + struct tpm_buf *buf __free(kfree) = kzalloc(TPM_BUFSIZE, GFP_KERNEL); +if (!buf) +return -ENOMEM ; + +tpm_buf_init (buf,TPM_BUFSIZE );if (chip->flags &TPM_CHIP_FLAG_TPM2 ) - rc =tpm_buf_init (&buf,TPM2_ST_SESSIONS , -TPM2_CC_SET_LOCALITY ); +tpm_buf_reset (buf,TPM2_ST_SESSIONS ,TPM2_CC_SET_LOCALITY );else - rc =tpm_buf_init (&buf,TPM_TAG_RQU_COMMAND , -TPM_ORD_SET_LOCALITY ); -if (rc) -return rc; -tpm_buf_append_u8 (&buf, locality); +tpm_buf_reset (buf,TPM_TAG_RQU_COMMAND ,TPM_ORD_SET_LOCALITY ); + +tpm_buf_append_u8 (buf, locality); proxy_dev->state |=STATE_DRIVER_COMMAND ; - rc =tpm_transmit_cmd (chip, &buf,0 ,"attempting to set locality" ); + rc =tpm_transmit_cmd (chip, buf,0 ,"attempting to set locality" ); proxy_dev->state &= ~STATE_DRIVER_COMMAND ; -if (rc <0 ) { - locality = rc; - goto out; - } +if (rc <0 ) +return rc; - header = (const struct tpm_header *)buf.data; + header = (const struct tpm_header *)buf->data; rc =be32_to_cpu (header->return_code);if (rc) locality =-1 ; -out: -tpm_buf_destroy (&buf); -return locality; }
include/linux/tpm.h +9 -8
@@ -208,13 +208,15 @@ enum tpm_buf_flags { };/* -* A string buffer type for constructing TPM commands. +* A buffer for constructing and parsing TPM commands, responses and sized +* (TPM2B) buffers. */ struct tpm_buf { -u32 flags; -u32 length; -u8 *data; +u8 flags; +u16 length; +u16 capacity;u8 handles; +u8 data[]; };struct tpm2_hash {
@@ -222,12 +224,11 @@ struct tpm2_hash {unsigned int tpm_id; }; -int tpm_buf_init (struct tpm_buf *buf,u16 tag,u32 ordinal); +void tpm_buf_init (struct tpm_buf *buf,u16 buf_size); +void tpm_buf_init_sized (struct tpm_buf *buf,u16 buf_size);void tpm_buf_reset (struct tpm_buf *buf,u16 tag,u32 ordinal); -int tpm_buf_init_sized (struct tpm_buf *buf);void tpm_buf_reset_sized (struct tpm_buf *buf); -void tpm_buf_destroy (struct tpm_buf *buf); -u32 tpm_buf_length (struct tpm_buf *buf); +u16 tpm_buf_length (struct tpm_buf *buf);void tpm_buf_append (struct tpm_buf *buf,const u8 *new_data,u16 new_length);void tpm_buf_append_u8 (struct tpm_buf *buf,const u8 value);void tpm_buf_append_u16 (struct tpm_buf *buf,const u16 value);
security/keys/trusted-keys/trusted_tpm1.c +20 -24
113 lines not on this page · raw message
security/keys/trusted-keys/trusted_tpm2.c +83 -82
305 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 8/8 tpm: fix off-by-four bounds check in tpm2_get_random()
In reply to Sasha LevinFrom: Jiangshan Yi <[email protected]>
[ Upstream commit 9b522400bf5c082feb9a0037a053ea822a2c7e4d ]
When the response carries the TPM2_ST_SESSIONS tag, tpm2_get_random() skips the 4-byte parameter size field before locating the random data, but the bounds check still validates the response length against TPM_HEADER_SIZE. A truncated response can pass the check and make memcpy() read up to 4 bytes past the response end, so stale buffer contents end up in the caller's random bytes.
Fix this by checking the response length against 'offset', which already includes the skipped parameter size field.
--- drivers/char/tpm/tpm2-cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm2-cmd.c +1 -1
@@ -305,7 +305,7 @@ int tpm2_get_random(struct tpm_chip *chip, u8 *dest, size_t max) out = (struct tpm2_get_random_out *)&buf->data[offset]; recd =min_t (u32,be16_to_cpu (out->size), num_bytes);if (tpm_buf_length (buf) < -TPM_HEADER_SIZE + + offset + offsetof(struct tpm2_get_random_out , buffer) + recd) {tpm2_end_auth_session (chip);
Signature · 1 line
2.53.0
Jarkko Sakkinen
maintainerPATCH 1/1 tpm: fix off-by-four bounds check in tpm2_get_random()
In reply to [email protected]From: Jiangshan Yi <[email protected]>
[ Upstream commit 9b522400bf5c082feb9a0037a053ea822a2c7e4d ]
When the response carries the TPM2_ST_SESSIONS tag, tpm2_get_random() skips the 4-byte parameter size field before locating the random data, but the bounds check still validates the response length against TPM_HEADER_SIZE. A truncated response can pass the check and make memcpy() read up to 4 bytes past the response end, so stale buffer contents end up in the caller's random bytes.
Fix this by checking the response length against 'offset', which already includes the skipped parameter size field.
--- drivers/char/tpm/tpm2-cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm2-cmd.c +1 -1
@@ -318,7 +318,7 @@ int tpm2_get_random(struct tpm_chip *chip, u8 *dest, size_t max) out = (struct tpm2_get_random_out *)&buf.data[offset]; recd =min_t (u32,be16_to_cpu (out->size), num_bytes);if (tpm_buf_length (&buf) < -TPM_HEADER_SIZE + + offset + offsetof(struct tpm2_get_random_out , buffer) + recd) { err = -EFAULT ;
Signature · 1 line
2.47.3
Re: [PATCH 7.2.y] tpm: fix off-by-four bounds check in tpm2_get_random()
Quoted 2 lines
Fix this by checking the response length against 'offset', which already includes the skipped parameter size field.
Queued for 7.2, thanks.
Signature · 2 lines
Thanks, Sasha