Skip to content

Commit edf8143

Browse files
isilenceaxboe
authored andcommitted
io_uring/net: fail zc send when unsupported by socket
If a protocol doesn't support zerocopy it will silently fall back to copying. This type of behaviour has always been a source of troubles so it's better to fail such requests instead. Cc: <[email protected]> # 6.0 Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/2db3c7f16bb6efab4b04569cd16e6242b40c5cb3.1666346426.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent e993ffe commit edf8143

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

io_uring/net.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,8 @@ int io_send_zc(struct io_kiocb *req, unsigned int issue_flags)
10561056
sock = sock_from_file(req->file);
10571057
if (unlikely(!sock))
10581058
return -ENOTSOCK;
1059+
if (!test_bit(SOCK_SUPPORT_ZC, &sock->flags))
1060+
return -EOPNOTSUPP;
10591061

10601062
msg.msg_name = NULL;
10611063
msg.msg_control = NULL;

0 commit comments

Comments
 (0)