aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--security/integrity/ima/ima_api.c4
-rw-r--r--security/integrity/ima/ima_main.c3
2 files changed, 4 insertions, 3 deletions
diff --git a/security/integrity/ima/ima_api.c b/security/integrity/ima/ima_api.c
index 86885979918c..a99eb6d4bc09 100644
--- a/security/integrity/ima/ima_api.c
+++ b/security/integrity/ima/ima_api.c
@@ -325,11 +325,11 @@ const char *ima_d_path(struct path *path, char **pathbuf)
325{ 325{
326 char *pathname = NULL; 326 char *pathname = NULL;
327 327
328 *pathbuf = kmalloc(PATH_MAX, GFP_KERNEL); 328 *pathbuf = __getname();
329 if (*pathbuf) { 329 if (*pathbuf) {
330 pathname = d_absolute_path(path, *pathbuf, PATH_MAX); 330 pathname = d_absolute_path(path, *pathbuf, PATH_MAX);
331 if (IS_ERR(pathname)) { 331 if (IS_ERR(pathname)) {
332 kfree(*pathbuf); 332 __putname(*pathbuf);
333 *pathbuf = NULL; 333 *pathbuf = NULL;
334 pathname = NULL; 334 pathname = NULL;
335 } 335 }
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index 72faf0b5b05c..eeee00dce729 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -246,7 +246,8 @@ out_digsig:
246 rc = -EACCES; 246 rc = -EACCES;
247 kfree(xattr_value); 247 kfree(xattr_value);
248out_free: 248out_free:
249 kfree(pathbuf); 249 if (pathbuf)
250 __putname(pathbuf);
250out: 251out:
251 mutex_unlock(&inode->i_mutex); 252 mutex_unlock(&inode->i_mutex);
252 if ((rc && must_appraise) && (ima_appraise & IMA_APPRAISE_ENFORCE)) 253 if ((rc && must_appraise) && (ima_appraise & IMA_APPRAISE_ENFORCE))