diff options
author | Dmitry Kasatkin <d.kasatkin@samsung.com> | 2014-06-13 11:55:48 -0400 |
---|---|---|
committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2014-07-17 09:35:09 -0400 |
commit | 209b43ca64a6f2b0c7ac66b457f530c52d608c3e (patch) | |
tree | 49b9c0d04b2abd63be87b6072b19edaa96d414ff /security | |
parent | 2c50b964823ebb7f0a098878c399ce859cd38e9e (diff) |
ima: delay template descriptor lookup until use
process_measurement() always calls ima_template_desc_current(),
including when an IMA policy has not been defined.
This patch delays template descriptor lookup until action is
determined.
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/integrity/ima/ima_main.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index cf1c3696c72e..f474c608fa11 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c | |||
@@ -159,7 +159,7 @@ static int process_measurement(struct file *file, const char *filename, | |||
159 | { | 159 | { |
160 | struct inode *inode = file_inode(file); | 160 | struct inode *inode = file_inode(file); |
161 | struct integrity_iint_cache *iint; | 161 | struct integrity_iint_cache *iint; |
162 | struct ima_template_desc *template_desc = ima_template_desc_current(); | 162 | struct ima_template_desc *template_desc; |
163 | char *pathbuf = NULL; | 163 | char *pathbuf = NULL; |
164 | const char *pathname = NULL; | 164 | const char *pathname = NULL; |
165 | int rc = -ENOMEM, action, must_appraise, _func; | 165 | int rc = -ENOMEM, action, must_appraise, _func; |
@@ -203,6 +203,7 @@ static int process_measurement(struct file *file, const char *filename, | |||
203 | goto out_digsig; | 203 | goto out_digsig; |
204 | } | 204 | } |
205 | 205 | ||
206 | template_desc = ima_template_desc_current(); | ||
206 | if (strcmp(template_desc->name, IMA_TEMPLATE_IMA_NAME) == 0) { | 207 | if (strcmp(template_desc->name, IMA_TEMPLATE_IMA_NAME) == 0) { |
207 | if (action & IMA_APPRAISE_SUBMASK) | 208 | if (action & IMA_APPRAISE_SUBMASK) |
208 | xattr_ptr = &xattr_value; | 209 | xattr_ptr = &xattr_value; |