io_uring: use user visible tail in io_uring_poll()
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 23 Jan 2023 14:37:13 +0000 (14:37 +0000)
committerJens Axboe <axboe@kernel.dk>
Sun, 29 Jan 2023 22:17:41 +0000 (15:17 -0700)
We return POLLIN from io_uring_poll() depending on whether there are
CQEs for the userspace, and so we should use the user visible tail
pointer instead of a transient cached value.

Cc: stable@vger.kernel.org
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/228ffcbf30ba98856f66ffdb9a6a60ead1dd96c0.1674484266.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c

index 4958725e0b972528275860af8bcdfe0b0a9d04a4..1681be25cf5809a9cad08059712fd099d3cbf1df 100644 (file)
@@ -2886,7 +2886,7 @@ static __poll_t io_uring_poll(struct file *file, poll_table *wait)
         * pushes them to do the flush.
         */
 
-       if (io_cqring_events(ctx) || io_has_work(ctx))
+       if (__io_cqring_events_user(ctx) || io_has_work(ctx))
                mask |= EPOLLIN | EPOLLRDNORM;
 
        return mask;