OpenCloudOS-Kernel/security/integrity/ima
Roberto Sassu a7ed7c60e1 ima: properly free ima_template_entry structures
The new templates management mechanism records information associated
to an event into an array of 'ima_field_data' structures and makes it
available through the 'template_data' field of the 'ima_template_entry'
structure (the element of the measurements list created by IMA).

Since 'ima_field_data' contains dynamically allocated data (which length
varies depending on the data associated to a selected template field),
it is not enough to just free the memory reserved for a
'ima_template_entry' structure if something goes wrong.

This patch creates the new function ima_free_template_entry() which
walks the array of 'ima_field_data' structures, frees the memory
referenced by the 'data' pointer and finally the space reserved for
the 'ima_template_entry' structure. Further, it replaces existing kfree()
that have a pointer to an 'ima_template_entry' structure as argument
with calls to the new function.

Fixes: a71dc65: ima: switch to new template management mechanism
Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
2013-12-02 20:46:56 -05:00
..
Kconfig Revert "ima: define '_ima' as a builtin 'trusted' keyring" 2013-11-23 16:36:35 -08:00
Makefile ima: define template fields library and new helpers 2013-10-25 17:17:05 -04:00
ima.h ima: properly free ima_template_entry structures 2013-12-02 20:46:56 -05:00
ima_api.c ima: properly free ima_template_entry structures 2013-12-02 20:46:56 -05:00
ima_appraise.c Revert "ima: define '_ima' as a builtin 'trusted' keyring" 2013-11-23 16:36:35 -08:00
ima_crypto.c ima: do not include field length in template digest calc for ima template 2013-11-25 07:26:28 -05:00
ima_fs.c ima: do not send field length to userspace for digest of ima template 2013-11-25 07:31:14 -05:00
ima_init.c ima: properly free ima_template_entry structures 2013-12-02 20:46:56 -05:00
ima_main.c ima: extend the measurement list to include the file signature 2013-10-31 20:19:35 -04:00
ima_policy.c Revert "ima: policy for RAMFS" 2013-10-25 13:17:19 -04:00
ima_queue.c ima: pass the filename argument up to ima_add_template_entry() 2013-10-25 17:17:03 -04:00
ima_template.c ima: store address of template_fmt_copy in a pointer before calling strsep 2013-11-30 13:09:53 +11:00
ima_template_lib.c ima: do not send field length to userspace for digest of ima template 2013-11-25 07:31:14 -05:00
ima_template_lib.h ima: extend the measurement list to include the file signature 2013-10-31 20:19:35 -04:00