Netdev List
 help / color / mirror / Atom feed
From: Yiming Qian <yimingqian591@gmail.com>
To: security@kernel.org
Cc: Kuniyuki Iwashima <kuniyu@google.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>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	lingchen5202005@gmail.com, yimingqian591@gmail.com
Subject: [PATCH] af_unix: mark MSG_SPLICE_PAGES frags shared
Date: Tue, 30 Jun 2026 15:05:56 +0800	[thread overview]
Message-ID: <20260630070600.484-1-yimingqian591@gmail.com> (raw)

unix_stream_sendmsg() splices external pages directly into skb frags when
MSG_SPLICE_PAGES is set, but it does not propagate SKBFL_SHARED_FRAG
afterward.

That leaves later writers without the shared-frag marker even though the
skb still references externally owned pages.

Set the marker after a successful skb_splice_from_iter() call.

Fixes: a0dbf5f818f90 ("af_unix: Support MSG_SPLICE_PAGES")
Reported-by: Yiming Qian <yimingqian591@gmail.com>
Reported-by: Can Liu <lingchen5202005@gmail.com>
Signed-off-by: Yiming Qian <yimingqian591@gmail.com>
Signed-off-by: Can Liu <lingchen5202005@gmail.com>
---
 net/unix/af_unix.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index f7a9d55eee8a1..f2cd0f8ec0914 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2458,6 +2458,7 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg,
 				goto out_free;
 
 			size = err;
+			skb_shinfo(skb)->flags |= SKBFL_SHARED_FRAG;
 			refcount_add(size, &sk->sk_wmem_alloc);
 		} else {
 			skb_put(skb, size - data_len);
-- 
2.34.1

             reply	other threads:[~2026-06-30  7:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30  7:05 Yiming Qian [this message]
2026-06-30 15:51 ` [PATCH] af_unix: mark MSG_SPLICE_PAGES frags shared Kuniyuki Iwashima

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=20260630070600.484-1-yimingqian591@gmail.com \
    --to=yimingqian591@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=lingchen5202005@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=security@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox