]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
procfs: make freeing proc_fs_info rcu-delayed
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 20 Sep 2023 04:12:00 +0000 (00:12 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 25 Feb 2024 07:10:32 +0000 (02:10 -0500)
makes proc_pid_ns() safe from rcu pathwalk (put_pid_ns()
is still synchronous, but that's not a problem - it does
rcu-delay everything that needs to be)

Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/proc/root.c
include/linux/proc_fs.h

index b55dbc70287b492ae2e4ed43e2a3c04ee0818798..06a297a27ba3b31a5e2092fcd08d1ca9eebb5849 100644 (file)
@@ -271,7 +271,7 @@ static void proc_kill_sb(struct super_block *sb)
 
        kill_anon_super(sb);
        put_pid_ns(fs_info->pid_ns);
-       kfree(fs_info);
+       kfree_rcu(fs_info, rcu);
 }
 
 static struct file_system_type proc_fs_type = {
index de407e7c3b55fdbd9b5d3cbe93585b1e417a3e20..0b2a8985444097f91cd0557563ad9438e3c494ea 100644 (file)
@@ -65,6 +65,7 @@ struct proc_fs_info {
        kgid_t pid_gid;
        enum proc_hidepid hide_pid;
        enum proc_pidonly pidonly;
+       struct rcu_head rcu;
 };
 
 static inline struct proc_fs_info *proc_sb_info(struct super_block *sb)