All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mina Almasry <almasrymina@google.com>
Cc: Mina Almasry <almasrymina@google.com>,
	Pavel Begunkov <asml.silence@gmail.com>,
	 Stanislav Fomichev <sdf@fomichev.me>,
	Bobby Eshleman <bobbyeshleman@gmail.com>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	 Will Deacon <will@kernel.org>,
	Antonio Quartulli <antonio@openvpn.net>,
	Ralf Lici <ralf@mandelbit.com>,
	 Kaiyuan Zhang <kaiyuanz@google.com>,
	 "open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: [PATCH net v1 2/3] net: devmem: return EMSGSIZE on type mismatch
Date: Sat,  1 Aug 2026 12:52:20 +0000	[thread overview]
Message-ID: <20260801125308.1342897-2-almasrymina@google.com> (raw)
In-Reply-To: <20260801125308.1342897-1-almasrymina@google.com>

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 <asml.silence@gmail.com>
Cc: Stanislav Fomichev <sdf@fomichev.me>
Cc: Bobby Eshleman <bobbyeshleman@gmail.com>
Signed-off-by: Mina Almasry <almasrymina@google.com>
---
 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


  reply	other threads:[~2026-08-01 12:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-01 12:52 [PATCH net v1 1/3] net: core: propagate unreadable flag in skb_zerocopy Mina Almasry
2026-08-01 12:52 ` Mina Almasry [this message]
2026-08-02 12:26   ` [PATCH net v1 2/3] net: devmem: return EMSGSIZE on type mismatch Pavel Begunkov
2026-08-01 12:52 ` [PATCH net v1 3/3] net: tcp: block standard payload injection into devmem skbs Mina Almasry
2026-08-02 12:25   ` Pavel Begunkov
2026-08-02 12:33 ` [PATCH net v1 1/3] net: core: propagate unreadable flag in skb_zerocopy Pavel Begunkov
2026-08-02 12:44   ` Pavel Begunkov
2026-08-03 15:49   ` Mina Almasry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260801125308.1342897-2-almasrymina@google.com \
    --to=almasrymina@google.com \
    --cc=antonio@openvpn.net \
    --cc=asml.silence@gmail.com \
    --cc=bobbyeshleman@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kaiyuanz@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ralf@mandelbit.com \
    --cc=sdf@fomichev.me \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.