]> git.baikalelectronics.ru Git - kernel.git/commitdiff
watch_queue: Fix missing rcu annotation
authorDavid Howells <dhowells@redhat.com>
Thu, 28 Jul 2022 09:31:06 +0000 (10:31 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 28 Jul 2022 17:06:49 +0000 (10:06 -0700)
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: 175295c8c9fa ("pipe: Add general notification queue support")
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/watch_queue.c

index bb9962b33f95cec8cd6203f62fe3adf1fca1a480..2c351765c409df34ff3d34b6f2d09b7c8ac79ef1 100644 (file)
@@ -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);