]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
x86/intel_rdt: Fix memory leak on mount failure
authorVikas Shivappa <vikas.shivappa@linux.intel.com>
Mon, 26 Jun 2017 18:55:49 +0000 (11:55 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Jul 2017 12:41:39 +0000 (14:41 +0200)
commit 79298acc4ba097e9ab78644e3e38902d73547c92 upstream.

If mount fails, the kn_info directory is not freed causing memory leak.

Add the missing error handling path.

Fixes: 4e978d06dedb ("x86/intel_rdt: Add "info" files to resctrl file system")
Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: ravi.v.shankar@intel.com
Cc: tony.luck@intel.com
Cc: fenghua.yu@intel.com
Cc: peterz@infradead.org
Cc: vikas.shivappa@intel.com
Cc: andi.kleen@intel.com
Link: http://lkml.kernel.org/r/1498503368-20173-3-git-send-email-vikas.shivappa@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c

index 9ac2a5cdd9c206e83f171847ac04d5bf4f2a3152..e79fb6b3dffe4ff8babc836a875acb634e3dfa2e 100644 (file)
@@ -767,11 +767,13 @@ static struct dentry *rdt_mount(struct file_system_type *fs_type,
        dentry = kernfs_mount(fs_type, flags, rdt_root,
                              RDTGROUP_SUPER_MAGIC, NULL);
        if (IS_ERR(dentry))
-               goto out_cdp;
+               goto out_destroy;
 
        static_branch_enable(&rdt_enable_key);
        goto out;
 
+out_destroy:
+       kernfs_remove(kn_info);
 out_cdp:
        cdp_disable();
 out: