[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8a214a83-303a-bd1f-fd7f-f84230d7d756@kernel.org>
Date: Sat, 15 Jul 2023 09:03:40 -0600
From: David Ahern <dsahern@...nel.org>
To: Yuanjun Gong <ruc_gongyuanjun@....com>,
"David S . Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH 1/1] net:ipv6: check return value of pskb_trim()
On 7/15/23 3:46 AM, Yuanjun Gong wrote:
> goto tx_err if an unexpected result is returned by pskb_tirm()
s/pskb_tirm/pskb_trim/
> in ip6erspan_tunnel_xmit().
>
> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@....com>
> ---
> net/ipv6/ip6_gre.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
> index da80974ad23a..92220b02e99f 100644
> --- a/net/ipv6/ip6_gre.c
> +++ b/net/ipv6/ip6_gre.c
> @@ -955,8 +955,10 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
> goto tx_err;
>
> if (skb->len > dev->mtu + dev->hard_header_len) {
> - pskb_trim(skb, dev->mtu + dev->hard_header_len);
> - truncate = true;
> + if (pskb_trim(skb, dev->mtu + dev->hard_header_len))
> + goto tx_err;
> + else
> + truncate = true;
> }
>
> nhoff = skb_network_offset(skb);
no need for the `else`:
if (pskb_trim(skb, dev->mtu + dev->hard_header_len))
goto tx_err;
truncate = true;
Powered by blists - more mailing lists