mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
Merge tag 'tpm-v7.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd
Pull TPM fixes from Jarkko Sakkinen: - Add the missing check of the return value of crypto_kpp_set_secret() when creating an authenticated HMAC session - Check the payload size of EVENT_TAG entries before reading them, in order to avoid out-of-bounds reads with a truncated TPM 1.x event log - Flush the timeout work outside buffer_mutex in tpm_common_read(), as the work itself takes the same mutex, which can lead to a deadlock - Fix a memory leak of the event log buffer in the error path of tpm_read_log_acpi() * tag 'tpm-v7.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd: tpm: acpi: Fix memory leak at tpm_read_log_acpi() error path tpm: flush timeout work outside buffer_mutex to avoid deadlock tpm: eventlog: check the payload size before reading tag events tpm: Check return value of crypto_kpp_set_secret()
This commit is contained in:
@@ -167,10 +167,8 @@ int tpm_read_log_acpi(struct tpm_chip *chip)
|
||||
}
|
||||
|
||||
ret = devm_add_action(&chip->dev, tpm_bios_log_free, log->bios_event_log);
|
||||
if (ret) {
|
||||
log->bios_event_log = NULL;
|
||||
if (ret)
|
||||
goto err;
|
||||
}
|
||||
|
||||
return format;
|
||||
|
||||
|
||||
@@ -178,6 +178,10 @@ static int get_event_name(char *dest, struct tcpa_event *event,
|
||||
}
|
||||
break;
|
||||
case EVENT_TAG:
|
||||
if (do_endian_conversion(event->event_size) <
|
||||
sizeof(pc_event->event_id))
|
||||
break;
|
||||
|
||||
pc_event = (struct tcpa_pc_event *)event_entry;
|
||||
|
||||
/* ToDo Row data -> Base64 */
|
||||
@@ -203,6 +207,9 @@ static int get_event_name(char *dest, struct tcpa_event *event,
|
||||
name = tcpa_pc_event_id_strings[do_endian_conversion
|
||||
(pc_event->event_id)];
|
||||
n_len = strlen(name);
|
||||
if (do_endian_conversion(event->event_size) <
|
||||
sizeof(struct tcpa_pc_event) + 20)
|
||||
break;
|
||||
for (i = 0; i < 20; i++)
|
||||
d_len += sprintf(&data[2*i], "%02x",
|
||||
pc_event->event_data[i]);
|
||||
|
||||
@@ -132,6 +132,7 @@ ssize_t tpm_common_read(struct file *file, char __user *buf,
|
||||
{
|
||||
struct file_priv *priv = file->private_data;
|
||||
ssize_t ret_size = 0;
|
||||
bool flush = false;
|
||||
int rc;
|
||||
|
||||
if (!size)
|
||||
@@ -164,9 +165,18 @@ out:
|
||||
if (!priv->response_length) {
|
||||
*off = 0;
|
||||
timer_delete_sync(&priv->user_read_timer);
|
||||
flush_work(&priv->timeout_work);
|
||||
flush = true;
|
||||
}
|
||||
mutex_unlock(&priv->buffer_mutex);
|
||||
|
||||
/*
|
||||
* tpm_timeout_work() takes buffer_mutex, so flush it after dropping
|
||||
* the mutex to avoid a deadlock; the timer is deleted above, so no new
|
||||
* timeout work can be queued once the mutex is released.
|
||||
*/
|
||||
if (flush)
|
||||
flush_work(&priv->timeout_work);
|
||||
|
||||
return ret_size;
|
||||
}
|
||||
|
||||
|
||||
@@ -527,7 +527,9 @@ static int tpm_buf_append_salt(struct tpm_buf *buf, struct tpm_chip *chip,
|
||||
}
|
||||
crypto_ecdh_encode_key(encoded_key, buf_len, &p);
|
||||
/* this generates a random private key */
|
||||
crypto_kpp_set_secret(kpp, encoded_key, buf_len);
|
||||
rc = crypto_kpp_set_secret(kpp, encoded_key, buf_len);
|
||||
if (rc)
|
||||
goto err_free_kpp;
|
||||
|
||||
/* salt is now the public point of this private key */
|
||||
req = kpp_request_alloc(kpp, GFP_KERNEL);
|
||||
|
||||
Reference in New Issue
Block a user