io_uring: convert accept4() -ERESTARTSYS into -EINTR
authorJens Axboe <axboe@kernel.dk>
Sun, 10 Nov 2019 02:52:33 +0000 (19:52 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 11 Nov 2019 03:29:49 +0000 (20:29 -0700)
If we cancel a pending accept operating with a signal, we get
-ERESTARTSYS returned. Turn that into -EINTR for userspace, we should
not be return -ERESTARTSYS.

Fixes: 17f2fe35d080 ("io_uring: add support for IORING_OP_ACCEPT")
Reported-by: Hrvoje Zeba <zeba.hrvoje@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index 737c311c6da53df808033f5fac29d0de7b2e7ffb..bbb3889dae41bd74013f40a836cc7722ecdc61f5 100644 (file)
@@ -1887,6 +1887,8 @@ static int io_accept(struct io_kiocb *req, const struct io_uring_sqe *sqe,
                req->work.flags |= IO_WQ_WORK_NEEDS_FILES;
                return -EAGAIN;
        }
+       if (ret == -ERESTARTSYS)
+               ret = -EINTR;
        if (ret < 0 && (req->flags & REQ_F_LINK))
                req->flags |= REQ_F_FAIL_LINK;
        io_cqring_add_event(req, ret);