Commit 58852d4d authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: fix double poll mask init

__io_queue_proc() is used by both, poll reqs and apoll. Don't use
req->poll.events to copy poll mask because for apoll it aliases with
private data of the request.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 4ea33a97
...@@ -5008,6 +5008,8 @@ static void __io_queue_proc(struct io_poll_iocb *poll, struct io_poll_table *pt, ...@@ -5008,6 +5008,8 @@ static void __io_queue_proc(struct io_poll_iocb *poll, struct io_poll_table *pt,
* for write). Setup a separate io_poll_iocb if this happens. * for write). Setup a separate io_poll_iocb if this happens.
*/ */
if (unlikely(poll->head)) { if (unlikely(poll->head)) {
struct io_poll_iocb *poll_one = poll;
/* already have a 2nd entry, fail a third attempt */ /* already have a 2nd entry, fail a third attempt */
if (*poll_ptr) { if (*poll_ptr) {
pt->error = -EINVAL; pt->error = -EINVAL;
...@@ -5018,7 +5020,7 @@ static void __io_queue_proc(struct io_poll_iocb *poll, struct io_poll_table *pt, ...@@ -5018,7 +5020,7 @@ static void __io_queue_proc(struct io_poll_iocb *poll, struct io_poll_table *pt,
pt->error = -ENOMEM; pt->error = -ENOMEM;
return; return;
} }
io_init_poll_iocb(poll, req->poll.events, io_poll_double_wake); io_init_poll_iocb(poll, poll_one->events, io_poll_double_wake);
refcount_inc(&req->refs); refcount_inc(&req->refs);
poll->wait.private = req; poll->wait.private = req;
*poll_ptr = poll; *poll_ptr = poll;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment