提交 456f5fd3 编写于 作者: D Dmitry Kasatkin 提交者: Mimi Zohar

ima: use path names cache

__getname() uses slab allocation which is faster than kmalloc.
Make use of it.
Signed-off-by: NDmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
上级 c2baec7f
...@@ -325,11 +325,11 @@ const char *ima_d_path(struct path *path, char **pathbuf) ...@@ -325,11 +325,11 @@ const char *ima_d_path(struct path *path, char **pathbuf)
{ {
char *pathname = NULL; char *pathname = NULL;
*pathbuf = kmalloc(PATH_MAX, GFP_KERNEL); *pathbuf = __getname();
if (*pathbuf) { if (*pathbuf) {
pathname = d_absolute_path(path, *pathbuf, PATH_MAX); pathname = d_absolute_path(path, *pathbuf, PATH_MAX);
if (IS_ERR(pathname)) { if (IS_ERR(pathname)) {
kfree(*pathbuf); __putname(*pathbuf);
*pathbuf = NULL; *pathbuf = NULL;
pathname = NULL; pathname = NULL;
} }
......
...@@ -246,7 +246,8 @@ static int process_measurement(struct file *file, int mask, int function, ...@@ -246,7 +246,8 @@ static int process_measurement(struct file *file, int mask, int function,
rc = -EACCES; rc = -EACCES;
kfree(xattr_value); kfree(xattr_value);
out_free: out_free:
kfree(pathbuf); if (pathbuf)
__putname(pathbuf);
out: out:
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
if ((rc && must_appraise) && (ima_appraise & IMA_APPRAISE_ENFORCE)) if ((rc && must_appraise) && (ima_appraise & IMA_APPRAISE_ENFORCE))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册