diff options
author | Rajiv Andrade <srajiv@linux.vnet.ibm.com> | 2009-02-05 10:06:30 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-02-05 17:06:43 -0500 |
commit | 8920d5ad6ba74ae8ab020e90cc4d976980e68701 (patch) | |
tree | 0ab5e0f47ed226a91e5520d9dcceee7d76ac7cac /drivers/char/tpm/tpm.c | |
parent | 64c61d80a6e4c935a09ac5ff1d952967ca1268f8 (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>
Diffstat (limited to 'drivers/char/tpm/tpm.c')
-rw-r--r-- | 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 62a5682578ca..ccdd828adcef 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -666,18 +666,20 @@ EXPORT_SYMBOL_GPL(tpm_show_temp_deactivated); | |||
666 | */ | 666 | */ |
667 | static struct tpm_chip *tpm_chip_find_get(int chip_num) | 667 | static struct tpm_chip *tpm_chip_find_get(int chip_num) |
668 | { | 668 | { |
669 | struct tpm_chip *pos; | 669 | struct tpm_chip *pos, *chip = NULL; |
670 | 670 | ||
671 | rcu_read_lock(); | 671 | rcu_read_lock(); |
672 | list_for_each_entry_rcu(pos, &tpm_chip_list, list) { | 672 | list_for_each_entry_rcu(pos, &tpm_chip_list, list) { |
673 | if (chip_num != TPM_ANY_NUM && chip_num != pos->dev_num) | 673 | if (chip_num != TPM_ANY_NUM && chip_num != pos->dev_num) |
674 | continue; | 674 | continue; |
675 | 675 | ||
676 | if (try_module_get(pos->dev->driver->owner)) | 676 | if (try_module_get(pos->dev->driver->owner)) { |
677 | chip = pos; | ||
677 | break; | 678 | break; |
679 | } | ||
678 | } | 680 | } |
679 | rcu_read_unlock(); | 681 | rcu_read_unlock(); |
680 | return pos; | 682 | return chip; |
681 | } | 683 | } |
682 | 684 | ||
683 | #define TPM_ORDINAL_PCRREAD cpu_to_be32(21) | 685 | #define TPM_ORDINAL_PCRREAD cpu_to_be32(21) |