summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRajiv Andrade <srajiv@linux.vnet.ibm.com>2009-02-05 13:06:30 -0200
committerJames Morris <jmorris@namei.org>2009-02-06 09:06:43 +1100
commit8920d5ad6ba74ae8ab020e90cc4d976980e68701 (patch)
tree0ab5e0f47ed226a91e5520d9dcceee7d76ac7cac
parent64c61d80a6e4c935a09ac5ff1d952967ca1268f8 (diff)
TPM: integrity fix
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> Acked-by: Serge Hallyn <serue@us.ibm.com> Signed-off-by: James Morris <jmorris@namei.org>
-rw-r--r--drivers/char/tpm/tpm.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 62a5682578c..ccdd828adce 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)