Skip to contentSkip to conversation

TPM: maintainers' update and small fixes

GIT PULL Applied Rajiv Andrade 2 participants 2 messages Jun 12, 2012 – Jun 13, 2012 1 message not in the archive TPM device driver

lore
Share & tools
lore
#0 lore raw

The following changes since commit 66dd07b88a1c9d446f32253da606b87324fa620e:

Merge commit 'v3.5-rc2' into next (2012-06-10 22:52:10 +1000)

are available in the git repository at:

git://github.com/srajiv/tpm.git for-james

Andi Shyti (1):
tpm: check the chip reference before using it

Rajiv Andrade (2):
MAINTAINERS: TPM maintainers' contacts update
TPM: chip disabled state erronously being reported as error

Wanlong Gao (1):
TPM: fix memleak when register hardware fails

 MAINTAINERS                     |    7 ++++---
 drivers/char/tpm/tpm.c          |   27 ++++++++++++++++++++-------
 drivers/char/tpm/tpm_infineon.c |    6 +++---
 3 files changed, 27 insertions(+), 13 deletions(-)
MAINTAINERS +4 -3
index 14bc707..58f5a7f 100644
@@ -6835,10 +6835,11 @@ F:	include/linux/shmem_fs.h
 F:	mm/shmem.c
 
 TPM DEVICE DRIVER
-M:	Debora Velarde <[email protected]>
-M:	Rajiv Andrade <[email protected]>
+M:	Kent Yoder <[email protected]>
+M:	Rajiv Andrade <[email protected]>
 W:	http://tpmdd.sourceforge.net
-M:	Marcel Selhorst <[email protected]>
+M:	Marcel Selhorst <[email protected]>
+M:	Sirrix AG <[email protected]>
 W:	http://www.sirrix.com
 L:	[email protected] (moderated for non-subscribers)
 S:	Maintained
drivers/char/tpm/tpm.c +20 -7
index ad7c732..d39b1f6 100644
@@ -827,10 +827,10 @@ EXPORT_SYMBOL_GPL(tpm_pcr_extend);
 int tpm_do_selftest(struct tpm_chip *chip)
 {
 	int rc;
-	u8 digest[TPM_DIGEST_SIZE];
 	unsigned int loops;
 	unsigned int delay_msec = 1000;
 	unsigned long duration;
+	struct tpm_cmd_t cmd;
 
 	duration = tpm_calc_ordinal_duration(chip,
 	                                     TPM_ORD_CONTINUE_SELFTEST);
@@ -845,7 +845,15 @@ int tpm_do_selftest(struct tpm_chip *chip)
 		return rc;
 
 	do {
-		rc = __tpm_pcr_read(chip, 0, digest);
+		/* Attempt to read a PCR value */
+		cmd.header.in = pcrread_header;
+		cmd.params.pcrread_in.pcr_idx = cpu_to_be32(0);
+		rc = tpm_transmit(chip, (u8 *) &cmd, READ_PCR_RESULT_SIZE);
+
+		if (rc < TPM_HEADER_SIZE)
+			return -EFAULT;
+
+		rc = be32_to_cpu(cmd.header.out.return_code);
 		if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) {
 			dev_info(chip->dev,
 				 "TPM is disabled/deactivated (0x%X)\n", rc);
@@ -1322,6 +1330,9 @@ EXPORT_SYMBOL_GPL(tpm_pm_resume);
 
 void tpm_dev_vendor_release(struct tpm_chip *chip)
 {
+	if (!chip)
+		return;
+
 	if (chip->vendor.release)
 		chip->vendor.release(chip->dev);
 
@@ -1339,6 +1350,9 @@ void tpm_dev_release(struct device *dev)
 {
 	struct tpm_chip *chip = dev_get_drvdata(dev);
 
+	if (!chip)
+		return;
+
 	tpm_dev_vendor_release(chip);
 
 	chip->release(dev);
@@ -1405,15 +1419,12 @@ struct tpm_chip *tpm_register_hardware(struct device *dev,
 			"unable to misc_register %s, minor %d\n",
 			chip->vendor.miscdev.name,
 			chip->vendor.miscdev.minor);
-		put_device(chip->dev);
-		return NULL;
+		goto put_device;
 	}
 
 	if (sysfs_create_group(&dev->kobj, chip->vendor.attr_group)) {
 		misc_deregister(&chip->vendor.miscdev);
-		put_device(chip->dev);
-
-		return NULL;
+		goto put_device;
 	}
 
 	chip->bios_dir = tpm_bios_log_setup(devname);
@@ -1425,6 +1436,8 @@ struct tpm_chip *tpm_register_hardware(struct device *dev,
 
 	return chip;
 
+put_device:
+	put_device(chip->dev);
 out_free:
 	kfree(chip);
 	kfree(devname);
drivers/char/tpm/tpm_infineon.c +3 -3
index 76da32e..3251a44 100644
@@ -4,8 +4,8 @@
  * SLD 9630 TT 1.1 and SLB 9635 TT 1.2 Trusted Platform Module
  * Specifications at www.trustedcomputinggroup.org
  *
- * Copyright (C) 2005, Marcel Selhorst <[email protected]>
- * Sirrix AG - security technologies, http://www.sirrix.com and
+ * Copyright (C) 2005, Marcel Selhorst <[email protected]>
+ * Sirrix AG - security technologies <[email protected]> and
  * Applied Data Security Group, Ruhr-University Bochum, Germany
  * Project-Homepage: http://www.trust.rub.de/projects/linux-device-driver-infineon-tpm/ 
  *
@@ -671,7 +671,7 @@ static void __exit cleanup_inf(void)
 module_init(init_inf);
 module_exit(cleanup_inf);
 
-MODULE_AUTHOR("Marcel Selhorst <[email protected]>");
+MODULE_AUTHOR("Marcel Selhorst <[email protected]>");
 MODULE_DESCRIPTION("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2");
 MODULE_VERSION("1.9.2");
 MODULE_LICENSE("GPL");