summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--io_uring/epoll.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/io_uring/epoll.c b/io_uring/epoll.c
index b9db8bde27ec..eecd748cad01 100644
--- a/io_uring/epoll.c
+++ b/io_uring/epoll.c
@@ -62,6 +62,9 @@ int io_epoll_ctl(struct io_kiocb *req, unsigned int issue_flags)
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;
key.file = fd_file(tf);
key.fd = ie->fd;