diff options
Diffstat (limited to 'security/integrity/ima/ima_queue.c')
| -rw-r--r-- | security/integrity/ima/ima_queue.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/security/integrity/ima/ima_queue.c b/security/integrity/ima/ima_queue.c index d85e99761f4f..552705d5a78d 100644 --- a/security/integrity/ima/ima_queue.c +++ b/security/integrity/ima/ima_queue.c | |||
| @@ -18,6 +18,9 @@ | |||
| 18 | * The measurement list is append-only. No entry is | 18 | * The measurement list is append-only. No entry is |
| 19 | * ever removed or changed during the boot-cycle. | 19 | * ever removed or changed during the boot-cycle. |
| 20 | */ | 20 | */ |
| 21 | |||
| 22 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
| 23 | |||
| 21 | #include <linux/module.h> | 24 | #include <linux/module.h> |
| 22 | #include <linux/rculist.h> | 25 | #include <linux/rculist.h> |
| 23 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
| @@ -72,7 +75,7 @@ static int ima_add_digest_entry(struct ima_template_entry *entry) | |||
| 72 | 75 | ||
| 73 | qe = kmalloc(sizeof(*qe), GFP_KERNEL); | 76 | qe = kmalloc(sizeof(*qe), GFP_KERNEL); |
| 74 | if (qe == NULL) { | 77 | if (qe == NULL) { |
| 75 | pr_err("IMA: OUT OF MEMORY ERROR creating queue entry.\n"); | 78 | pr_err("OUT OF MEMORY ERROR creating queue entry\n"); |
| 76 | return -ENOMEM; | 79 | return -ENOMEM; |
| 77 | } | 80 | } |
| 78 | qe->entry = entry; | 81 | qe->entry = entry; |
| @@ -95,8 +98,7 @@ static int ima_pcr_extend(const u8 *hash) | |||
| 95 | 98 | ||
| 96 | result = tpm_pcr_extend(TPM_ANY_NUM, CONFIG_IMA_MEASURE_PCR_IDX, hash); | 99 | result = tpm_pcr_extend(TPM_ANY_NUM, CONFIG_IMA_MEASURE_PCR_IDX, hash); |
| 97 | if (result != 0) | 100 | if (result != 0) |
| 98 | pr_err("IMA: Error Communicating to TPM chip, result: %d\n", | 101 | pr_err("Error Communicating to TPM chip, result: %d\n", result); |
| 99 | result); | ||
| 100 | return result; | 102 | return result; |
| 101 | } | 103 | } |
| 102 | 104 | ||
| @@ -115,7 +117,7 @@ int ima_add_template_entry(struct ima_template_entry *entry, int violation, | |||
| 115 | 117 | ||
| 116 | mutex_lock(&ima_extend_list_mutex); | 118 | mutex_lock(&ima_extend_list_mutex); |
| 117 | if (!violation) { | 119 | if (!violation) { |
| 118 | memcpy(digest, entry->digest, sizeof digest); | 120 | memcpy(digest, entry->digest, sizeof(digest)); |
| 119 | if (ima_lookup_digest_entry(digest)) { | 121 | if (ima_lookup_digest_entry(digest)) { |
| 120 | audit_cause = "hash_exists"; | 122 | audit_cause = "hash_exists"; |
| 121 | result = -EEXIST; | 123 | result = -EEXIST; |
| @@ -131,7 +133,7 @@ int ima_add_template_entry(struct ima_template_entry *entry, int violation, | |||
| 131 | } | 133 | } |
| 132 | 134 | ||
| 133 | if (violation) /* invalidate pcr */ | 135 | if (violation) /* invalidate pcr */ |
| 134 | memset(digest, 0xff, sizeof digest); | 136 | memset(digest, 0xff, sizeof(digest)); |
| 135 | 137 | ||
| 136 | tpmresult = ima_pcr_extend(digest); | 138 | tpmresult = ima_pcr_extend(digest); |
| 137 | if (tpmresult != 0) { | 139 | if (tpmresult != 0) { |
