[PATCH] ima: fix return value of ima_restore_measurement_list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When the function restore_template_fmt returns NULL due to insufficient
memory, the ima_restore_measurement_list function will exit and the IMA
measurement list recovery fails. However, since the return value of
ima_restore_measurement_list is 0, there will be no prompt for IMA
measurement list recovery failure in ima_load_kexec_buffer, which can
easily cause misunderstandings for users.

Signed-off-by: Yan Zhu <zhuyan2015@xxxxxxxxxxx>
---
 security/integrity/ima/ima_template.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c
index 04c49f0..1b030cd 100644
--- a/security/integrity/ima/ima_template.c
+++ b/security/integrity/ima/ima_template.c
@@ -489,8 +489,10 @@ int ima_restore_measurement_list(loff_t size, void *buf)
 		template_desc = lookup_template_desc(template_name);
 		if (!template_desc) {
 			template_desc = restore_template_fmt(template_name);
-			if (!template_desc)
+			if (!template_desc) {
+				ret = -ENOMEM;
 				break;
+			}
 		}
 
 		/*
-- 
2.33.0




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux