Netdev List
 help / color / mirror / Atom feed
* [PATCH net 1/1] tcp: reject non zerocopy devmem tx
@ 2026-08-22 10:57 Pavel Begunkov
  2026-08-23 15:58 ` Mina Almasry
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Begunkov @ 2026-08-22 10:57 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, netdev
  Cc: asml.silence, Mina Almasry

Device memory send doesn't work without zero copy, prevent
tcp_sendmsg_locked() from falling back to the copy mode for devmem in
case there is no NETIF_F_SG. Currently, it'd try to copy from iovec
filled with dma-buf offsets, which would normally fail with EFAULT, but
it's still better to handle it more explicitly. A recent net-iov / page
mixing fix also needs this patch.

Fixes: bd61848900bff ("net: devmem: Implement TX path")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 net/ipv4/tcp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 455441f1b694..f403830af65f 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1162,6 +1162,10 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size)
 					binding = NULL;
 					goto out_err;
 				}
+				if (zc != MSG_ZEROCOPY) {
+					err = -EOPNOTSUPP;
+					goto out_err;
+				}
 			}
 		}
 	} else if (unlikely(msg->msg_flags & MSG_SPLICE_PAGES) && size) {
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-08-28 12:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-22 10:57 [PATCH net 1/1] tcp: reject non zerocopy devmem tx Pavel Begunkov
2026-08-23 15:58 ` Mina Almasry
2026-08-24  8:27   ` David Laight
2026-08-26 14:36   ` Pavel Begunkov
2026-08-26 17:29     ` Mina Almasry
2026-08-28 12:37       ` Pavel Begunkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox