diff options
author | Dmitry Kasatkin <dmitry.kasatkin@gmail.com> | 2014-10-01 14:43:10 -0400 |
---|---|---|
committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2014-10-07 14:32:54 -0400 |
commit | 456f5fd3f6017f10d04d459159ac7bd9e3815c5e (patch) | |
tree | 304de71a234e3c302f7b372f72affd5661f30221 /security/integrity | |
parent | c2baec7ffaf6a2c15e03028ed9ef82a92cc49a94 (diff) |
ima: use path names cache
__getname() uses slab allocation which is faster than kmalloc.
Make use of it.
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'security/integrity')
-rw-r--r-- | security/integrity/ima/ima_api.c | 4 | ||||
-rw-r--r-- | security/integrity/ima/ima_main.c | 3 |
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); |
248 | out_free: | 248 | out_free: |
249 | kfree(pathbuf); | 249 | if (pathbuf) |
250 | __putname(pathbuf); | ||
250 | out: | 251 | out: |
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)) |