summaryrefslogtreecommitdiffstats
path: root/io_uring
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2025-01-10 11:59:08 +0100
committerChristian Brauner <brauner@kernel.org>2025-01-10 11:59:45 +0100
commit67cd2e23c0f353803f182ae790a7d5074d4c1a4d (patch)
tree21b4329a819a52e988be56b5faefd9a78255f896 /io_uring
parentLinux 6.13-rc1 (diff)
parentpoll: kill poll_does_not_wait() (diff)
downloadlinux-67cd2e23c0f353803f182ae790a7d5074d4c1a4d.tar.xz
linux-67cd2e23c0f353803f182ae790a7d5074d4c1a4d.zip
Merge patch series "poll_wait: add mb() to fix theoretical race between waitqueue_active() and .poll()"
Oleg Nesterov <oleg@redhat.com> says: The waitqueue_active() helper can only be used if both waker and waiter have memory barriers that pair with each other. But __pollwait() is broken in this respect. Fix it. * patches from https://lore.kernel.org/r/20250107162649.GA18886@redhat.com: poll: kill poll_does_not_wait() sock_poll_wait: kill the no longer necessary barrier after poll_wait() io_uring_poll: kill the no longer necessary barrier after poll_wait() poll_wait: kill the obsolete wait_address check poll_wait: add mb() to fix theoretical race between waitqueue_active() and .poll() Link: https://lore.kernel.org/r/20250107162649.GA18886@redhat.com Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/io_uring.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 06ff41484e29..a64a82b93b86 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -2809,13 +2809,12 @@ static __poll_t io_uring_poll(struct file *file, poll_table *wait)
if (unlikely(!ctx->poll_activated))
io_activate_pollwq(ctx);
-
- poll_wait(file, &ctx->poll_wq, wait);
/*
- * synchronizes with barrier from wq_has_sleeper call in
- * io_commit_cqring
+ * provides mb() which pairs with barrier from wq_has_sleeper
+ * call in io_commit_cqring
*/
- smp_rmb();
+ poll_wait(file, &ctx->poll_wq, wait);
+
if (!io_sqring_full(ctx))
mask |= EPOLLOUT | EPOLLWRNORM;