diff mbox series

[for-6.1,2/2] io_uring/net: fail zc sendmsg for unsupported protocols

Message ID 0f5e5b81ab680649bf56f025da94497f3f6a3f53.1666229889.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series don't fallback if sock doesn't undestand zc | expand

Commit Message

Pavel Begunkov Oct. 20, 2022, 1:42 a.m. UTC
The previous patch fails zerocopy send requests for protocols that don't
support it, do the same for zerocopy sendmsg.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 io_uring/net.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/io_uring/net.c b/io_uring/net.c
index 28127f1de1f0..735eec545115 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -1160,6 +1160,8 @@  int io_sendmsg_zc(struct io_kiocb *req, unsigned int issue_flags)
 	sock = sock_from_file(req->file);
 	if (unlikely(!sock))
 		return -ENOTSOCK;
+	if (!io_sock_support_zc(sock))
+		return -EOPNOTSUPP;
 
 	if (req_has_async_data(req)) {
 		kmsg = req->async_data;