[PATCH net-next v2] net: devmem: return EMSGSIZE on type mismatch
Mina Almasry <[email protected]>
| Newsgroups | org.kernel.vger.netdev,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
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]>
Signed-off-by: Mina Almasry <[email protected]>
Reviewed-by: Pavel Begunkov <[email protected]>
Reviewed-by: 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(-)
diff --git a/net/core/datagram.c b/net/core/datagram.c
index 173b5d97bd409..6f8ffd61bcab4 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -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
--
2.55.0.679.g6767b8d81c-goog