summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-06-18 08:09:57 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-06-18 08:09:57 -0700
commit2f9f5887b42711595e768b9dc0582dccfdf60c3b (patch)
tree99f073aad173b54753d580dec6d1268a608194f5 /io_uring
parente771677c937da5808f7b6c1f0e4a97ec1a84f8a8 (diff)
parentcfa1539b24aff18ecb71c6334e7270f810d145bb (diff)
downloadlinux-2f9f5887b42711595e768b9dc0582dccfdf60c3b.tar.gz
linux-2f9f5887b42711595e768b9dc0582dccfdf60c3b.zip
Merge tag 'for-7.2/io_uring-epoll-20260616' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux
Pull io_uring epoll update from Jens Axboe: "As discussed a few months ago, this pull request gets rid of allowing nested epoll notification contexts via io_uring. Nested contexts have been a source of issues on the epoll side, and there should not be a need to support them from io_uring. The epoll io_uring side exists mainly to facilitate a gradual migration from a notification based epoll setup to an io_uring ditto" * tag 'for-7.2/io_uring-epoll-20260616' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: io_uring/epoll: disallow adding an epoll file to an epoll context io_uring/epoll: switch to using do_epoll_ctl_file() interface
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/epoll.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/io_uring/epoll.c b/io_uring/epoll.c
index 8d4610246ba0..eecd748cad01 100644
--- a/io_uring/epoll.c
+++ b/io_uring/epoll.c
@@ -51,10 +51,24 @@ int io_epoll_ctl_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
int io_epoll_ctl(struct io_kiocb *req, unsigned int issue_flags)
{
struct io_epoll *ie = io_kiocb_to_cmd(req, struct io_epoll);
- int ret;
bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK;
+ struct epoll_key key;
+ int ret;
+
+ CLASS(fd, f)(ie->epfd);
+ if (fd_empty(f))
+ return -EBADF;
+
+ CLASS(fd, tf)(ie->fd);
+ if (fd_empty(tf))
+ return -EBADF;
+ /* disallow adding an epoll context to another epoll context */
+ if (ie->op == EPOLL_CTL_ADD && is_file_epoll(fd_file(tf)))
+ return -EINVAL;
- ret = do_epoll_ctl(ie->epfd, ie->op, ie->fd, &ie->event, force_nonblock);
+ key.file = fd_file(tf);
+ key.fd = ie->fd;
+ ret = do_epoll_ctl_file(fd_file(f), ie->op, &key, &ie->event, force_nonblock);
if (force_nonblock && ret == -EAGAIN)
return -EAGAIN;