diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2022-06-20 01:26:01 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-06-22 11:32:34 -0600 |
commit | 85f0b5fabbf88357b288cff16d95904e95719eac (patch) | |
tree | 275393b3aedfc642c1cc40bfdb42bcba4c9863f2 | |
parent | 71cc513ec7bc33e6159a3c0f759168039faa4c9a (diff) |
io_uring: add a warn_once for poll_find
io_poll_remove() expects poll_find() to search only for poll requests and
passes a flag for this. Just be a little bit extra cautious considering
lots of recent poll/cancellation changes and add a WARN_ON_ONCE checking
that we don't get an apoll'ed request.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/ec9a66f1e22f99dcd02288d4e42f3cc6bb357804.1655684496.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | io_uring/poll.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/io_uring/poll.c b/io_uring/poll.c index cbf44c38efd9..bd3110750cfa 100644 --- a/io_uring/poll.c +++ b/io_uring/poll.c @@ -833,6 +833,11 @@ int io_poll_remove(struct io_kiocb *req, unsigned int issue_flags) } found: + if (WARN_ON_ONCE(preq->opcode != IORING_OP_POLL_ADD)) { + ret = -EFAULT; + goto out; + } + if (poll_update->update_events || poll_update->update_user_data) { /* only mask one event flags, keep behavior flags */ if (poll_update->update_events) { |