Skip to content

Commit 3c84005

Browse files
isilenceaxboe
authored andcommitted
io_uring/net: copy addr for zc on POLL_FIRST
Every time we return from an issue handler and expect the request to be retried we should also setup it for async exec ourselves. Do that when we return on IORING_RECVSEND_POLL_FIRST in io_sendzc(), otherwise it'll re-read the address, which might be a surprise for the userspace. Fixes: 092aeed ("io_uring: allow to pass addr into sendzc") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/ab1d0657890d6721339c56d2e161a4bba06f85d0.1662642013.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 336d28a commit 3c84005

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

io_uring/net.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,9 +1003,6 @@ int io_sendzc(struct io_kiocb *req, unsigned int issue_flags)
10031003
unsigned msg_flags, cflags;
10041004
int ret, min_ret = 0;
10051005

1006-
if (!(req->flags & REQ_F_POLLED) &&
1007-
(zc->flags & IORING_RECVSEND_POLL_FIRST))
1008-
return -EAGAIN;
10091006
sock = sock_from_file(req->file);
10101007
if (unlikely(!sock))
10111008
return -ENOTSOCK;
@@ -1030,6 +1027,10 @@ int io_sendzc(struct io_kiocb *req, unsigned int issue_flags)
10301027
msg.msg_namelen = zc->addr_len;
10311028
}
10321029

1030+
if (!(req->flags & REQ_F_POLLED) &&
1031+
(zc->flags & IORING_RECVSEND_POLL_FIRST))
1032+
return io_setup_async_addr(req, addr, issue_flags);
1033+
10331034
if (zc->flags & IORING_RECVSEND_FIXED_BUF) {
10341035
ret = io_import_fixed(WRITE, &msg.msg_iter, req->imu,
10351036
(u64)(uintptr_t)zc->buf, zc->len);

0 commit comments

Comments
 (0)