]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 16 Sep 2022 08:53:39 +0000 (10:53 +0200)
BugLink: https://bugs.launchpad.net/bugs/1989218
commit e0339f036ef4beb9b20f0b6532a1e0ece7f594c6 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: c73be61cede5 ("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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
kernel/watch_queue.c

index debebcd2664ef1d7cec0e9a2f323af4e09109dad..7019d337ce861c7a3c4663a4c4ee8795e03fae88 100644 (file)
@@ -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);