[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <681bc8f326126_20e9e6294b1@willemb.c.googlers.com.notmuch>
Date: Wed, 07 May 2025 16:56:19 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Jon Kohler <jon@...anix.com>,
Willem de Bruijn <willemdebruijn.kernel@...il.com>,
Jason Wang <jasowang@...hat.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
bpf@...r.kernel.org
Cc: Jon Kohler <jon@...anix.com>
Subject: Re: [PATCH net-next] tun: use xdp_get_frame_len()
Jon Kohler wrote:
> Use xdp_get_frame_len helper to ensure xdp frame size is calculated
> correctly in both single buffer and multi buffer configurations.
Not necessarily opposed, but multi buffer is not actually possible
in this code path, right?
tun_put_user_xdp only copies xdp_frame->data, for one.
Else this would also be fix, not net-next material.
>
> Signed-off-by: Jon Kohler <jon@...anix.com>
> ---
> drivers/net/tun.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 7babd1e9a378..1c879467e696 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -1993,7 +1993,7 @@ static ssize_t tun_put_user_xdp(struct tun_struct *tun,
> struct iov_iter *iter)
> {
> int vnet_hdr_sz = 0;
> - size_t size = xdp_frame->len;
> + size_t size = xdp_get_frame_len(xdp_frame);
> ssize_t ret;
>
> if (tun->flags & IFF_VNET_HDR) {
> @@ -2579,7 +2579,7 @@ static int tun_ptr_peek_len(void *ptr)
> if (tun_is_xdp_frame(ptr)) {
> struct xdp_frame *xdpf = tun_ptr_to_xdp(ptr);
>
> - return xdpf->len;
> + return xdp_get_frame_len(xdpf);
> }
> return __skb_array_len_with_tag(ptr);
> } else {
> --
> 2.43.0
>
Powered by blists - more mailing lists