Skip to content

Commit

Permalink
watch_queue: Fix missing rcu annotation
Browse files Browse the repository at this point in the history
commit e0339f0 upstream.

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: c73be61 ("pipe: Add general notification queue support")
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
dhowells authored and gregkh committed Aug 3, 2022
1 parent 11c1cc3 commit 093610f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/watch_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,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);
Expand Down

0 comments on commit 093610f

Please sign in to comment.