mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Kyuwon Cho <kyuwoncho18@gmail.com>
Cc: David Ahern <dsahern@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	Simon Horman <horms@kernel.org>,
	David Howells <dhowells@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 1/1] ipv6: fix MSG_SPLICE_PAGES with a dst trailer in __ip6_append_data()
Date: Sun, 22 Nov 2026 13:33:30 +0200	[thread overview]
Message-ID: <20261122113330.GA2781890@shredder> (raw)
In-Reply-To: <179534083350.2499182.16621119046570934510@gmail.com>

On Sun, Nov 22, 2026 at 07:24:07PM +0900, Kyuwon Cho wrote:
> When __ip6_append_data() starts a new skb for a fragment that is not
> the last one, it adds the dst's trailer_len to datalen. On the paged
> path pagedlen was computed before that, so with an xfrm dst
> 
> 	copy = datalen - transhdrlen - fraggap - pagedlen;
> 
> is trailer_len instead of 0. getfrag() copies those bytes from the
> message iterator, but the MSG_SPLICE_PAGES branch right after it also
> runs when getfrag() succeeds and resets copy to 0, so length is not
> reduced by the bytes just copied. On the next pass the splice branch
> finds copy larger than what is left in the iterator, warns and returns
> -EIO, so sendfile() of a UDPv6 datagram that needs fragmentation over
> an xfrm tunnel fails:
> 
>   WARNING: net/ipv6/ip6_output.c:1796 at __ip6_append_data+0x17ed/0x4b70
>   RIP: 0010:__ip6_append_data (net/ipv6/ip6_output.c:1796)
>   Call Trace:
>    <TASK>
>    ip6_make_skb (net/ipv6/ip6_output.c:2097)
>    udpv6_sendmsg (net/ipv6/udp.c:1717)
>    sock_sendmsg (net/socket.c:841)
>    splice_to_socket (fs/splice.c:811)
>    direct_splice_actor (fs/splice.c:863 fs/splice.c:1114)
>    splice_direct_to_actor (fs/splice.c:1023)
>    do_splice_direct (fs/splice.c:1157 fs/splice.c:1183)
>    do_sendfile (fs/read_write.c:1351)
> 
> IPv4 is not affected: __ip_append_data() does not add trailer_len to
> datalen.
> 
> The branch was added by commit ce650a166335 ("udp6: Fix
> __ip6_append_data()'s handling of MSG_SPLICE_PAGES"), when copy could
> be negative on this path. Since commit 736b380e28d0 ("ipv6: account for
> fraggap on the paged allocation path") a negative copy returns -EINVAL
> before this point, so remove the branch.
> 
> Fixes: ce650a166335 ("udp6: Fix __ip6_append_data()'s handling of MSG_SPLICE_PAGES")
> Signed-off-by: Kyuwon Cho <kyuwoncho18@gmail.com>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

      reply	other threads:[~2026-11-22 11:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 10:24 [PATCH net 0/1] " Kyuwon Cho
2026-11-22 10:24 ` [PATCH net 1/1] " Kyuwon Cho
2026-11-22 11:33   ` Ido Schimmel [this message]

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=20261122113330.GA2781890@shredder \
    --to=idosch@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kyuwoncho18@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.com \
    /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

all inboxes | Powered by JetHome®