Re: [PATCH v3 4/9] fs/resctrl: Fix deadlock for errors during mount
From: Chen, Yu C
Date: Fri May 29 2026 - 10:16:48 EST
On 5/23/2026 3:15 AM, Reinette Chatre wrote:
@@ -3085,10 +3105,37 @@ static int rdt_get_tree(struct fs_context *fc)
RESCTRL_PICK_ANY_CPU);
}
- goto out;
+ /*
+ * Ensure root kn remains accessible after mutex is unlocked so that
Maybe a little more accurate to say "Ensure rdt_root remains accessible"?
Here we increase reference for rdtgroup_default.kn, and protect
against UAF of
kernfs_kill_sb(sb) ->
info = kernfs_info(sb) ->
kernfs_put(info->root->kn)
where the info->root is UAF rather than the kn.
Other looks good to me.
Reviewed-by: Chen Yu <yu.c.chen@xxxxxxxxx>
thanks,
Chenyu
+ * kernfs_kill_sb() can run safely if called by kernfs_get_tree()'s
+ * failure path after creating a superblock but before taking reference
+ * on root kn.
+ */
+ kernfs_get(rdtgroup_default.kn);