Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 456f5fd3 authored by Dmitry Kasatkin's avatar Dmitry Kasatkin Committed by Mimi Zohar
Browse files

ima: use path names cache



__getname() uses slab allocation which is faster than kmalloc.
Make use of it.

Signed-off-by: default avatarDmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: default avatarMimi Zohar <zohar@linux.vnet.ibm.com>
parent c2baec7f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -325,11 +325,11 @@ const char *ima_d_path(struct path *path, char **pathbuf)
{
	char *pathname = NULL;

	*pathbuf = kmalloc(PATH_MAX, GFP_KERNEL);
	*pathbuf = __getname();
	if (*pathbuf) {
		pathname = d_absolute_path(path, *pathbuf, PATH_MAX);
		if (IS_ERR(pathname)) {
			kfree(*pathbuf);
			__putname(*pathbuf);
			*pathbuf = NULL;
			pathname = NULL;
		}
+2 −1
Original line number Diff line number Diff line
@@ -246,7 +246,8 @@ static int process_measurement(struct file *file, int mask, int function,
		rc = -EACCES;
	kfree(xattr_value);
out_free:
	kfree(pathbuf);
	if (pathbuf)
		__putname(pathbuf);
out:
	mutex_unlock(&inode->i_mutex);
	if ((rc && must_appraise) && (ima_appraise & IMA_APPRAISE_ENFORCE))