Skip to content

Commit ca0676a

Browse files
aeglbp3tk0v
authored andcommitted
fs/resctrl: Free mon_data structures on rdt_get_tree() failure
If mkdir_mondata_all() or a subsequent call in rdt_get_tree() fails, the mon_data structures allocated by mon_get_kn_priv() are leaked. Add mon_put_kn_priv() to the out_mongrp error path to free the mon_data structures. Fixes: 2a65660 ("x86/resctrl: Expand the width of domid by replacing mon_data_bits") Closes: https://lore.kernel.org/lkml/5d38c1fb-8f91-472b-8897-24b2f50c772b@intel.com/ Reported-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Chen Yu <yu.c.chen@intel.com> Reviewed-by: Ben Horgan <ben.horgan@arm.com> Cc: <stable@kernel.org> Link: https://patch.msgid.link/433623b7e3316ffd52323255d1aa4f156ad97cb1.1783377598.git.reinette.chatre@intel.com
1 parent 8cdeaa5 commit ca0676a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

fs/resctrl/rdtgroup.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ static int rdtgroup_setup_root(struct rdt_fs_context *ctx);
7474

7575
static void rdtgroup_destroy_root(void);
7676

77+
static void mon_put_kn_priv(void);
78+
7779
struct dentry *debugfs_resctrl;
7880

7981
/*
@@ -2893,6 +2895,7 @@ static int rdt_get_tree(struct fs_context *fc)
28932895
kernfs_remove(kn_mondata);
28942896
out_mongrp:
28952897
if (resctrl_arch_mon_capable()) {
2898+
mon_put_kn_priv();
28962899
rdtgroup_unassign_cntrs(&rdtgroup_default);
28972900
kernfs_remove(kn_mongrp);
28982901
}

0 commit comments

Comments
 (0)