list: add "list_del_init_careful()" to go with "list_empty_careful()"

[ Upstream commit c6fe44d96fc1536af5b11cd859686453d1b7bfd1 ]

That gives us ordering guarantees around the pair.

Signed-off-by: Linus Torvalds <[email protected]>
Stable-dep-of: 2192bba03d80 ("epoll: ep_autoremove_wake_function should use list_del_init_careful")
Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
Linus Torvalds 2020-07-23 12:33:41 -07:00 • committed by Greg Kroah-Hartman
commit e77e5481d5
3 changed files with 21 additions and 8 deletions

View file

@ -1085,13 +1085,8 @@ static int wake_page_function(wait_queue_entry_t *wait, unsigned mode, int sync,
* since after list_del_init(&wait->entry) the wait entry
* might be de-allocated and the process might even have
* exited.
*
* We _really_ should have a "list_del_init_careful()" to
* properly pair with the unlocked "list_empty_careful()"
* in finish_wait().
*/
smp_mb();
list_del_init(&wait->entry);
list_del_init_careful(&wait->entry);
return ret;
}