Message ID | tencent_3373B90C5A9E646DDCF91C0D8CAD2184BC0A@qq.com (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | ima: fix return value of ima_restore_measurement_list | expand |
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; + } } /*
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@foxmail.com> --- security/integrity/ima/ima_template.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)