Commit 79298acc authored by Vikas Shivappa's avatar Vikas Shivappa Committed by Thomas Gleixner

x86/intel_rdt: Fix memory leak on mount failure

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

Add the missing error handling path.

Fixes: 4e978d06 ("x86/intel_rdt: Add "info" files to resctrl file system")
Signed-off-by: default avatarVikas Shivappa <vikas.shivappa@linux.intel.com>
Signed-off-by: default avatarThomas 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
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/1498503368-20173-3-git-send-email-vikas.shivappa@linux.intel.com
parent 8eabf42a
...@@ -856,11 +856,13 @@ static struct dentry *rdt_mount(struct file_system_type *fs_type, ...@@ -856,11 +856,13 @@ static struct dentry *rdt_mount(struct file_system_type *fs_type,
dentry = kernfs_mount(fs_type, flags, rdt_root, dentry = kernfs_mount(fs_type, flags, rdt_root,
RDTGROUP_SUPER_MAGIC, NULL); RDTGROUP_SUPER_MAGIC, NULL);
if (IS_ERR(dentry)) if (IS_ERR(dentry))
goto out_cdp; goto out_destroy;
static_branch_enable(&rdt_enable_key); static_branch_enable(&rdt_enable_key);
goto out; goto out;
out_destroy:
kernfs_remove(kn_info);
out_cdp: out_cdp:
cdp_disable(); cdp_disable();
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment