Skip to contentSkip to conversation

net: devmem: return EMSGSIZE on type mismatch

PATCH In review Mina Almasry 3 participants 3 messages Aug 10 – Aug 12

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: devmem: return EMSGSIZE on type mismatch

When a devmem payload mixes with a standard page payload, return -EMSGSIZE instead of -EFAULT. This enables tcp_sendmsg to seamlessly fall back to creating a new segment instead of failing the socket send.

Fixes bd61848900bff ("net: devmem: Implement TX path")
Cc Pavel Begunkov <[email protected]>
Cc Stanislav Fomichev <[email protected]>
Cc Bobby Eshleman <[email protected]>

---
v2: Sent to net-next instead of net (Jakub). Otherwise no changes.
v1: https://lore.kernel.org/r/[email protected]

---
 net/core/datagram.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/datagram.c +2 -2
index 173b5d97bd409..6f8ffd61bcab4 100644
@@ -638,7 +638,7 @@ int zerocopy_fill_skb_from_iter(struct sk_buff *skb,
 	int frag = skb_shinfo(skb)->nr_frags;
 
 	if (!skb_frags_readable(skb))
-		return -EFAULT;
+		return -EMSGSIZE;
 
 	while (length && iov_iter_count(from)) {
 		struct page *head, *last_head = NULL;
@@ -713,7 +713,7 @@ zerocopy_fill_skb_from_devmem(struct sk_buff *skb, struct iov_iter *from,
 	struct net_iov *niov;
 
 	if (i && skb_frags_readable(skb))
-		return -EFAULT;
+		return -EMSGSIZE;
 
 	/* Devmem filling works by taking an IOVEC from the user where the
 	 * iov_addrs are interpreted as an offset in bytes into the dma-buf to

base-commit: 001b5d347d8ba39b2dccaefcc57967b18caec8fe

Signature · 1 line
2.55.0.679.g6767b8d81c-goog
Acked-by on v2 1/1
#1 lore raw
Quoted 11 lines · Mina Almasry

When a devmem payload mixes with a standard page payload, return -EMSGSIZE instead of -EFAULT. This enables tcp_sendmsg to seamlessly fall back to creating a new segment instead of failing the socket send.

Fixes bd61848900bff ("net: devmem: Implement TX path")
Cc Pavel Begunkov <[email protected]>
Cc Stanislav Fomichev <[email protected]>
Cc Bobby Eshleman <[email protected]>

(matches my original suggestion on
https://lore.kernel.org/netdev/[email protected]/)

maintainer
#2 lore raw
In reply to Mina Almasry
Quoted 5 lines · On Mon, 10 Aug 2026 20:11:48 +0000 Mina Almasry wrote:

When a devmem payload mixes with a standard page payload, return -EMSGSIZE instead of -EFAULT. This enables tcp_sendmsg to seamlessly fall back to creating a new segment instead of failing the socket send.

Fixes bd61848900bff ("net: devmem: Implement TX path")

Please drop the Fixes tag and repost this _after_ the devmem fixes you're sending are in net-next.

Signature · 1 line
pw-bot: defer