[PATCH] IMA: Add log statements for failure conditions.

Tushar Sugandhi
2020-02-07T19:53:59Z

process_buffer_measurement() and ima_alloc_key_entry()
functions do not have log messages for failure conditions.

This change adds log statements in the above functions.

Signed-off-by: Tushar Sugandhi <tusharsu@linux.microsoft.com>
Reviewed-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
---
security/integrity/ima/ima_main.c | 4 ++++
security/integrity/ima/ima_queue_keys.c | 2 ++
2 files changed, 6 insertions(+)

diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index 9fe949c6a530..afab796fb765 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -757,6 +757,10 @@ void process_buffer_measurement(const void *buf, int size,
ima_free_template_entry(entry);

out:
+ if (ret < 0)
+ pr_err("Process buffer measurement failed, result: %d\n",
+ ret);
+
return;
}

diff --git a/security/integrity/ima/ima_queue_keys.c b/security/integrity/ima/ima_queue_keys.c
index c87c72299191..2cc52f17ea81 100644
--- a/security/integrity/ima/ima_queue_keys.c
+++ b/security/integrity/ima/ima_queue_keys.c
@@ -90,6 +90,8 @@ static struct ima_key_entry *ima_alloc_key_entry(struct key *keyring,

out:
if (rc) {
+ pr_err("Key entry allocation failed, result: %d\n",
+ rc);
ima_free_key_entry(entry);
entry = NULL;
}
--
2.17.1