Fixes: 36b3306779ea ("fs: cache the string generated by reading /proc/filesystems") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/20261205021350.CpVtXk0E-lkp@intel.com/ Signed-off-by: Mateusz Guzik --- fs/filesystems.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/filesystems.c b/fs/filesystems.c index a09f4fd95ac0..319fd02e1667 100644 --- a/fs/filesystems.c +++ b/fs/filesystems.c @@ -247,7 +247,7 @@ static void invalidate_filesystems_string(void) lockdep_assert_held_write(&file_systems_lock); file_systems_gen++; - old = rcu_replace_pointer(file_systems_string, NULL, + old = rcu_replace_pointer(file_systems_string, (struct file_systems_string *)NULL, lockdep_is_held(&file_systems_lock)); if (old) kfree_rcu(old, rcu); @@ -283,7 +283,8 @@ static __cold noinline int regen_filesystems_string(void) new->string[newlen] = '\0'; spin_lock(&file_systems_lock); - old = file_systems_string; + old = rcu_dereference_protected(file_systems_string, + lockdep_is_held(&file_systems_lock)); /* * Did someone beat us to it? -- 2.53.0