From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CB931ED38 for ; Tue, 25 Jul 2023 11:33:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97B15C433C7; Tue, 25 Jul 2023 11:33:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1690284794; bh=WfMnpKhnqmgKXvzFcgaDWNC/O8CAcGwu+0160m08B5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=07x+e5Zo4ZCMSW+8otL2qqFEVWGav2I4PGiXADV/TQMpaBiwm4Awz3RdkdJXszzVA Lqal9pL45fpuOgaxs2shaCoxj9Dn3E4Mj1B7qrmJUbvnrH+K+TRARQ/tg/1RdYsS6y PmjRlspBu0Kxy9stBcQ9gU53aKPQjfLbqZW4kPDg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yuanjun Gong , David Ahern , Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 484/509] net:ipv6: check return value of pskb_trim() Date: Tue, 25 Jul 2023 12:47:03 +0200 Message-ID: <20230725104615.904353716@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230725104553.588743331@linuxfoundation.org> References: <20230725104553.588743331@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Yuanjun Gong [ Upstream commit 4258faa130be4ea43e5e2d839467da421b8ff274 ] goto tx_err if an unexpected result is returned by pskb_tirm() in ip6erspan_tunnel_xmit(). Fixes: 5a963eb61b7c ("ip6_gre: Add ERSPAN native tunnel support") Signed-off-by: Yuanjun Gong Reviewed-by: David Ahern Reviewed-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv6/ip6_gre.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 7b50e1811678e..2df1036330f80 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -955,7 +955,8 @@ 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); + if (pskb_trim(skb, dev->mtu + dev->hard_header_len)) + goto tx_err; truncate = true; } -- 2.39.2