Skip to content

Commit b1a1bd1

Browse files
committed
Merge: TPM: Update to upstream 6.16
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6994 Backport fixes from upstream. JIRA: https://issues.redhat.com/browse/RHEL-72765 Signed-off-by: Štěpán Horáček <shoracek@redhat.com> Approved-by: John W. Linville <linville@redhat.com> Approved-by: Jerry Snitselaar <jsnitsel@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Jarod Wilson <jarod@redhat.com>
2 parents 4f0f6c6 + 82afdf1 commit b1a1bd1

File tree

8 files changed

+211
-160
lines changed

8 files changed

+211
-160
lines changed

drivers/char/tpm/tpm-buf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ static void tpm_buf_read(struct tpm_buf *buf, off_t *offset, size_t count, void
180180
*/
181181
u8 tpm_buf_read_u8(struct tpm_buf *buf, off_t *offset)
182182
{
183-
u8 value;
183+
u8 value = 0;
184184

185185
tpm_buf_read(buf, offset, sizeof(value), &value);
186186

@@ -197,7 +197,7 @@ EXPORT_SYMBOL_GPL(tpm_buf_read_u8);
197197
*/
198198
u16 tpm_buf_read_u16(struct tpm_buf *buf, off_t *offset)
199199
{
200-
u16 value;
200+
u16 value = 0;
201201

202202
tpm_buf_read(buf, offset, sizeof(value), &value);
203203

@@ -214,7 +214,7 @@ EXPORT_SYMBOL_GPL(tpm_buf_read_u16);
214214
*/
215215
u32 tpm_buf_read_u32(struct tpm_buf *buf, off_t *offset)
216216
{
217-
u32 value;
217+
u32 value = 0;
218218

219219
tpm_buf_read(buf, offset, sizeof(value), &value);
220220

drivers/char/tpm/tpm-chip.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ int tpm_try_get_ops(struct tpm_chip *chip)
160160
goto out_ops;
161161

162162
mutex_lock(&chip->tpm_mutex);
163+
164+
/* tmp_chip_start may issue IO that is denied while suspended */
165+
if (chip->flags & TPM_CHIP_FLAG_SUSPENDED)
166+
goto out_lock;
167+
163168
rc = tpm_chip_start(chip);
164169
if (rc)
165170
goto out_lock;

drivers/char/tpm/tpm-interface.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -468,18 +468,11 @@ int tpm_get_random(struct tpm_chip *chip, u8 *out, size_t max)
468468
if (!chip)
469469
return -ENODEV;
470470

471-
/* Give back zero bytes, as TPM chip has not yet fully resumed: */
472-
if (chip->flags & TPM_CHIP_FLAG_SUSPENDED) {
473-
rc = 0;
474-
goto out;
475-
}
476-
477471
if (chip->flags & TPM_CHIP_FLAG_TPM2)
478472
rc = tpm2_get_random(chip, out, max);
479473
else
480474
rc = tpm1_get_random(chip, out, max);
481475

482-
out:
483476
tpm_put_ops(chip);
484477
return rc;
485478
}

drivers/char/tpm/tpm_ibmvtpm.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ static bool tpm_ibmvtpm_req_canceled(struct tpm_chip *chip, u8 status)
450450
}
451451

452452
static const struct tpm_class_ops tpm_ibmvtpm = {
453+
.flags = TPM_OPS_AUTO_STARTUP,
453454
.recv = tpm_ibmvtpm_recv,
454455
.send = tpm_ibmvtpm_send,
455456
.cancel = tpm_ibmvtpm_cancel,
@@ -690,16 +691,6 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
690691
if (!strcmp(id->compat, "IBM,vtpm20"))
691692
chip->flags |= TPM_CHIP_FLAG_TPM2;
692693

693-
rc = tpm_get_timeouts(chip);
694-
if (rc)
695-
goto init_irq_cleanup;
696-
697-
if (chip->flags & TPM_CHIP_FLAG_TPM2) {
698-
rc = tpm2_get_cc_attrs_tbl(chip);
699-
if (rc)
700-
goto init_irq_cleanup;
701-
}
702-
703694
return tpm_chip_register(chip);
704695
init_irq_cleanup:
705696
do {

drivers/char/tpm/tpm_tis.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info)
266266
irq = tpm_info->irq;
267267

268268
if (itpm || is_itpm(ACPI_COMPANION(dev)))
269-
phy->priv.flags |= TPM_TIS_ITPM_WORKAROUND;
269+
set_bit(TPM_TIS_ITPM_WORKAROUND, &phy->priv.flags);
270270

271271
return tpm_tis_core_init(dev, &phy->priv, irq, &tpm_tcg,
272272
ACPI_HANDLE(dev));

0 commit comments

Comments
 (0)