From: David Howells Date: Thu, 28 Jul 2022 09:31:06 +0000 (+0100) Subject: watch_queue: Fix missing rcu annotation X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=e0339f036ef4beb9b20f0b6532a1e0ece7f594c6;p=linux.git watch_queue: Fix missing rcu annotation Since __post_watch_notification() walks wlist->watchers with only the RCU read lock held, we need to use RCU methods to add to the list (we already use RCU methods to remove from the list). Fix add_watch_to_object() to use hlist_add_head_rcu() instead of hlist_add_head() for that list. Fixes: c73be61cede5 ("pipe: Add general notification queue support") Signed-off-by: David Howells Signed-off-by: Linus Torvalds --- diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c index bb9962b33f95c..2c351765c409d 100644 --- a/kernel/watch_queue.c +++ b/kernel/watch_queue.c @@ -494,7 +494,7 @@ int add_watch_to_object(struct watch *watch, struct watch_list *wlist) unlock_wqueue(wqueue); } - hlist_add_head(&watch->list_node, &wlist->watchers); + hlist_add_head_rcu(&watch->list_node, &wlist->watchers); return 0; } EXPORT_SYMBOL(add_watch_to_object);