Commit 66d2d00d authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: fix uninit old data for poll event upd

Both IORING_POLL_UPDATE_EVENTS and IORING_POLL_UPDATE_USER_DATA need
old_user_data to find/cancel a poll request, but it's set only for the
first one.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/ab08fd35b7652e977f9a475f01741b04102297f1.1618278933.git.asml.silence@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 08480400
...@@ -5379,17 +5379,17 @@ static int io_poll_add_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe ...@@ -5379,17 +5379,17 @@ static int io_poll_add_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe
if (!(flags & IORING_POLL_ADD_MULTI)) if (!(flags & IORING_POLL_ADD_MULTI))
events |= EPOLLONESHOT; events |= EPOLLONESHOT;
poll->update_events = poll->update_user_data = false; poll->update_events = poll->update_user_data = false;
if (flags & IORING_POLL_UPDATE_EVENTS) {
poll->update_events = true; if (flags & (IORING_POLL_UPDATE_EVENTS|IORING_POLL_UPDATE_USER_DATA)) {
poll->old_user_data = READ_ONCE(sqe->addr); poll->old_user_data = READ_ONCE(sqe->addr);
} poll->update_events = flags & IORING_POLL_UPDATE_EVENTS;
if (flags & IORING_POLL_UPDATE_USER_DATA) { poll->update_user_data = flags & IORING_POLL_UPDATE_USER_DATA;
poll->update_user_data = true; if (poll->update_user_data)
poll->new_user_data = READ_ONCE(sqe->off); poll->new_user_data = READ_ONCE(sqe->off);
} } else {
if (!(poll->update_events || poll->update_user_data) && if (sqe->off || sqe->addr)
(sqe->off || sqe->addr))
return -EINVAL; return -EINVAL;
}
poll->events = demangle_poll(events) | poll->events = demangle_poll(events) |
(events & (EPOLLEXCLUSIVE|EPOLLONESHOT)); (events & (EPOLLEXCLUSIVE|EPOLLONESHOT));
return 0; return 0;
......
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