提交 3a3f4536 编写于 作者: D David Howells 提交者: Zheng Zengkai

watch_queue: Fix missing rcu annotation

stable inclusion
from stable-v5.10.135
commit 45a84f04a9a08a43a4ef7f6d5a965fbf664c802f
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5ZWFM

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=45a84f04a9a08a43a4ef7f6d5a965fbf664c802f

--------------------------------

commit e0339f03 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: c73be61c ("pipe: Add general notification queue support")
Signed-off-by: NDavid Howells <dhowells@redhat.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 e36a2e06
...@@ -497,7 +497,7 @@ int add_watch_to_object(struct watch *watch, struct watch_list *wlist) ...@@ -497,7 +497,7 @@ int add_watch_to_object(struct watch *watch, struct watch_list *wlist)
unlock_wqueue(wqueue); unlock_wqueue(wqueue);
} }
hlist_add_head(&watch->list_node, &wlist->watchers); hlist_add_head_rcu(&watch->list_node, &wlist->watchers);
return 0; return 0;
} }
EXPORT_SYMBOL(add_watch_to_object); EXPORT_SYMBOL(add_watch_to_object);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册