diff options
Diffstat (limited to 'security/integrity/ima/ima_queue.c')
| -rw-r--r-- | security/integrity/ima/ima_queue.c | 22 | 
1 files changed, 12 insertions, 10 deletions
diff --git a/security/integrity/ima/ima_queue.c b/security/integrity/ima/ima_queue.c index ff63fe00c19..552705d5a78 100644 --- a/security/integrity/ima/ima_queue.c +++ b/security/integrity/ima/ima_queue.c @@ -18,6 +18,9 @@   *       The measurement list is append-only. No entry is   *       ever removed or changed during the boot-cycle.   */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +  #include <linux/module.h>  #include <linux/rculist.h>  #include <linux/slab.h> @@ -50,7 +53,7 @@ static struct ima_queue_entry *ima_lookup_digest_entry(u8 *digest_value)  	key = ima_hash_key(digest_value);  	rcu_read_lock();  	hlist_for_each_entry_rcu(qe, &ima_htable.queue[key], hnext) { -		rc = memcmp(qe->entry->digest, digest_value, IMA_DIGEST_SIZE); +		rc = memcmp(qe->entry->digest, digest_value, TPM_DIGEST_SIZE);  		if (rc == 0) {  			ret = qe;  			break; @@ -72,7 +75,7 @@ static int ima_add_digest_entry(struct ima_template_entry *entry)  	qe = kmalloc(sizeof(*qe), GFP_KERNEL);  	if (qe == NULL) { -		pr_err("IMA: OUT OF MEMORY ERROR creating queue entry.\n"); +		pr_err("OUT OF MEMORY ERROR creating queue entry\n");  		return -ENOMEM;  	}  	qe->entry = entry; @@ -95,8 +98,7 @@ static int ima_pcr_extend(const u8 *hash)  	result = tpm_pcr_extend(TPM_ANY_NUM, CONFIG_IMA_MEASURE_PCR_IDX, hash);  	if (result != 0) -		pr_err("IMA: Error Communicating to TPM chip, result: %d\n", -		       result); +		pr_err("Error Communicating to TPM chip, result: %d\n", result);  	return result;  } @@ -104,9 +106,10 @@ static int ima_pcr_extend(const u8 *hash)   * and extend the pcr.   */  int ima_add_template_entry(struct ima_template_entry *entry, int violation, -			   const char *op, struct inode *inode) +			   const char *op, struct inode *inode, +			   const unsigned char *filename)  { -	u8 digest[IMA_DIGEST_SIZE]; +	u8 digest[TPM_DIGEST_SIZE];  	const char *audit_cause = "hash_added";  	char tpm_audit_cause[AUDIT_CAUSE_LEN_MAX];  	int audit_info = 1; @@ -114,7 +117,7 @@ int ima_add_template_entry(struct ima_template_entry *entry, int violation,  	mutex_lock(&ima_extend_list_mutex);  	if (!violation) { -		memcpy(digest, entry->digest, sizeof digest); +		memcpy(digest, entry->digest, sizeof(digest));  		if (ima_lookup_digest_entry(digest)) {  			audit_cause = "hash_exists";  			result = -EEXIST; @@ -130,7 +133,7 @@ int ima_add_template_entry(struct ima_template_entry *entry, int violation,  	}  	if (violation)		/* invalidate pcr */ -		memset(digest, 0xff, sizeof digest); +		memset(digest, 0xff, sizeof(digest));  	tpmresult = ima_pcr_extend(digest);  	if (tpmresult != 0) { @@ -141,8 +144,7 @@ int ima_add_template_entry(struct ima_template_entry *entry, int violation,  	}  out:  	mutex_unlock(&ima_extend_list_mutex); -	integrity_audit_msg(AUDIT_INTEGRITY_PCR, inode, -			    entry->template.file_name, +	integrity_audit_msg(AUDIT_INTEGRITY_PCR, inode, filename,  			    op, audit_cause, result, audit_info);  	return result;  }  | 
