OSDN Git Service

ovl: fix memory leak on unlink of indexed file
authorAmir Goldstein <amir73il@gmail.com>
Tue, 18 Sep 2018 13:34:31 +0000 (16:34 +0300)
committerMiklos Szeredi <mszeredi@redhat.com>
Mon, 24 Sep 2018 08:54:01 +0000 (10:54 +0200)
The memory leak was detected by kmemleak when running xfstests
overlay/051,053

Fixes: caf70cb2ba5d ("ovl: cleanup orphan index entries")
Cc: <stable@vger.kernel.org> # v4.13
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/util.c

index 8cfb62c..ace4fe4 100644 (file)
@@ -683,7 +683,7 @@ static void ovl_cleanup_index(struct dentry *dentry)
        struct dentry *upperdentry = ovl_dentry_upper(dentry);
        struct dentry *index = NULL;
        struct inode *inode;
-       struct qstr name;
+       struct qstr name = { };
        int err;
 
        err = ovl_get_index_name(lowerdentry, &name);
@@ -726,6 +726,7 @@ static void ovl_cleanup_index(struct dentry *dentry)
                goto fail;
 
 out:
+       kfree(name.name);
        dput(index);
        return;