ima: use path names cache
[firefly-linux-kernel-4.4.55.git] / security / integrity / ima / ima_api.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;
                }