From patchwork Mon Jul 17 14:45:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuanjun Gong X-Patchwork-Id: 13315848 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 B5884253AD for ; Mon, 17 Jul 2023 14:45:56 +0000 (UTC) Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 94EAF1B6 for ; Mon, 17 Jul 2023 07:45:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=l6ukIbG8s37NXfVJ7n x0nCHVZnkKRb7L+4Q86aJARho=; b=B2YBnKdamc8jUW5d12dOGGm0CdnnPhZBys 4tIdl3kzZ1tsRt6hz7DgGOegUBVBUalo5kvat/MUY648gjN6zuchcC1dvZivD7Jx w8sZjz3Ae7VVNHuHsfMIZzPVDUArQgNJzbZGQe1UM+ySkAVifsYNWd6bJHWSM3LW GfSBylHrY= Received: from localhost.localdomain (unknown [202.112.113.212]) by zwqz-smtp-mta-g3-0 (Coremail) with SMTP id _____wA3VlkBVLVkq6MkAg--.59810S4; Mon, 17 Jul 2023 22:45:27 +0800 (CST) From: Yuanjun Gong To: Yuanjun Gong , "David S . Miller" , David Ahern , netdev@vger.kernel.org Subject: [PATCH v2 1/1] net:ipv6: check return value of pskb_trim() Date: Mon, 17 Jul 2023 22:45:19 +0800 Message-Id: <20230717144519.21740-1-ruc_gongyuanjun@163.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: _____wA3VlkBVLVkq6MkAg--.59810S4 X-Coremail-Antispam: 1Uf129KBjvdXoW7JFWxury7uw1UCw1xCw47twb_yoWxtFbEq3 97Ga4DGr4xX3WUtw4fJw1Yqr1Fk3W0yF1rZF1xAF9Yga45tr1rCrWkCr4kCr4UGFWfCryU Gr1YkFyUCF4fGjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sR_knY5UUUUU== X-Originating-IP: [202.112.113.212] X-CM-SenderInfo: 5uxfsw5rqj53pdqm30i6rwjhhfrp/xtbBiAev5VaEFzdOEAAAsp X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_L3, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-Patchwork-Delegate: kuba@kernel.org goto tx_err if an unexpected result is returned by pskb_tirm() in ip6erspan_tunnel_xmit(). Signed-off-by: Yuanjun Gong Reviewed-by: David Ahern Reviewed-by: Kuniyuki Iwashima --- 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 da80974ad23a..070d87abf7c0 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; }