Skip to content

Commit

Permalink
io_uring/net: fail zc send when unsupported by socket
Browse files Browse the repository at this point in the history
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: <stable@vger.kernel.org> # 6.0
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
  • Loading branch information
isilence committed Oct 20, 2022
1 parent 3dafafa commit 4c66110
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions io_uring/net.c
Expand Up @@ -1056,6 +1056,8 @@ int io_send_zc(struct io_kiocb *req, unsigned int issue_flags)
sock = sock_from_file(req->file);
if (unlikely(!sock))
return -ENOTSOCK;
if (!test_flag(SOCK_SUPPORT_ZC, &sock->flags))
return -EOPNOTSUPP;

msg.msg_name = NULL;
msg.msg_control = NULL;
Expand Down

0 comments on commit 4c66110

Please sign in to comment.