Skip to content

Commit 244575d

Browse files
devnexengregkh
authored andcommitted
eventfs: Use list_add_tail_rcu() for SRCU-protected children list
[ Upstream commit f67950b2887fa10df50c4317a1fe98a65bc6875b ] Commit d260327 ("eventfs: Use list_del_rcu() for SRCU protected list variable") converted the removal side to pair with the list_for_each_entry_srcu() walker in eventfs_iterate(). The insertion in eventfs_create_dir() was left as a plain list_add_tail(), which on weakly-ordered architectures can expose a new entry to the SRCU reader before its list pointers and fields are observable. Use list_add_tail_rcu() so the publication pairs with the existing list_del_rcu() and list_for_each_entry_srcu(). Fixes: 43aa6f9 ("eventfs: Get rid of dentry pointers without refcounts") Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260418152251.199343-1-devnexen@gmail.com Signed-off-by: David Carlier <devnexen@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> [ adapted scoped_guard(mutex, &eventfs_mutex) block to explicit mutex_lock()/mutex_unlock() pair ] Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4fa42a2 commit 244575d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/tracefs/event_inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode
732732

733733
mutex_lock(&eventfs_mutex);
734734
if (!parent->is_freed)
735-
list_add_tail(&ei->list, &parent->children);
735+
list_add_tail_rcu(&ei->list, &parent->children);
736736
mutex_unlock(&eventfs_mutex);
737737

738738
/* Was the parent freed? */

0 commit comments

Comments
 (0)