]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
ima: use path names cache
authorDmitry Kasatkin <dmitry.kasatkin@gmail.com>
Wed, 1 Oct 2014 18:43:10 +0000 (21:43 +0300)
committerMimi Zohar <zohar@linux.vnet.ibm.com>
Tue, 7 Oct 2014 18:32:54 +0000 (14:32 -0400)
__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>
security/integrity/ima/ima_api.c
security/integrity/ima/ima_main.c

index 86885979918c187fef5298c86ba9de7a97ab968b..a99eb6d4bc09dc76b86ae9f49627e00e361f8beb 100644 (file)
@@ -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;
                }
index 72faf0b5b05c83295dffa3c0d33f150d81755478..eeee00dce72903d8b9e5b00d75588b10495bd8fc 100644 (file)
@@ -246,7 +246,8 @@ out_digsig:
                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))