public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] TPM: integrity fix
@ 2009-02-05 15:06 Rajiv Andrade
  2009-02-05 15:26 ` Serge E. Hallyn
  2009-02-05 22:37 ` James Morris
  0 siblings, 2 replies; 4+ messages in thread
From: Rajiv Andrade @ 2009-02-05 15:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: jmorris, akpm, serue, safford, Mimi Zohar

Fix to function which is called by IMA, now tpm_chip_find_get() considers the case in which the machine doesn't have a TPM or, if it has, its TPM isn't enabled.

Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
---
 drivers/char/tpm/tpm.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 0387965..912a473 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -666,18 +666,20 @@ EXPORT_SYMBOL_GPL(tpm_show_temp_deactivated);
  */
 static struct tpm_chip *tpm_chip_find_get(int chip_num)
 {
-	struct tpm_chip *pos;
+	struct tpm_chip *pos, *chip = NULL;
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(pos, &tpm_chip_list, list) {
 		if (chip_num != TPM_ANY_NUM && chip_num != pos->dev_num)
 			continue;
 
-		if (try_module_get(pos->dev->driver->owner))
+		if (try_module_get(pos->dev->driver->owner)) {
+			chip = pos;
 			break;
+		}
 	}
 	rcu_read_unlock();
-	return pos;
+	return chip;
 }
 
 #define TPM_ORDINAL_PCRREAD cpu_to_be32(21)
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-02-05 22:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-05 15:06 [PATCH] TPM: integrity fix Rajiv Andrade
2009-02-05 15:26 ` Serge E. Hallyn
2009-02-05 16:05   ` Rajiv Andrade
2009-02-05 22:37 ` James Morris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox