Re: [PATCH net v2 2/3] net: devmem: return EMSGSIZE on type mismatch
Bobby Eshleman <[email protected]> Mon, 3 Aug 2026 10:32:18 -0700
| Newsgroups | org.kernel.vger.netdev,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Aug 03, 2026 at 05:14:40PM +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")
> 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]>
> ---
> 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
> --
> 2.55.0.571.g244d577d93-goog
>
Reviewed-by: Bobby Eshleman <[email protected]>