Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2422642rdh; Sun, 29 Oct 2023 15:57:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGMx9dS08u+KIGQbBOwjysCJabSwUoLh8kkHMPVS0jjkV84e8Vsp3VRzYvRkPpNOA7dVTuE X-Received: by 2002:a17:902:c94d:b0:1cc:4e78:d10f with SMTP id i13-20020a170902c94d00b001cc4e78d10fmr718912pla.8.1698620266677; Sun, 29 Oct 2023 15:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698620266; cv=none; d=google.com; s=arc-20160816; b=lRBpCahLfGDEpBGSjcMY/QwTw/APlfIk+CKF2bU2fzAupuktr1g4rhIdiim5epiQsH Y3Hc0VpmstCviBBiimGkcZsnS4reJcrRiPh/9dcRSFV5mjDh3C3CihBN8Bj0RNTTmVOO A94sAUK8e3fWvMFUIhrCxSWDbdo0b9z5k6bNEyDibXWlfCKjcRd9FurQP/w1XBmU4NWe DfbLlEN4lTQsq8I8gXkSvstMJC201xCZ9wqW/+5Uq2KGCEkF9zPMWbFRyaMEbr9hiLXs /S9RXbkBttNsxH3zuakZwnmG3GLQIb5+AHsbRBAjL9IxZZ+J7GUGASpUWSJaHiuDwYYF 2AaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+PFw9Ia4DAbSNRJY9efY8r4jbv4wlUkQg0Pu1w9nAME=; fh=rN/4mc0gikGsCZZKxpbnin4Jsbhqwf5UmoityTExS9w=; b=H4mudklOGjzE2ncbI7/RPey0DFn27NkegT+X5+FV0NYKhfmr5UBEjTNJ92W/3ZqO9X X2iKhAwfHNb0sK2Cs8oDXpqbh5IWaf7xMMEH3G+v4sipa7Nbnq/XQ/KD9OQGHKs4BdOg pEzifIpxbOcNaDu9KAgXiwGWI7Ik8OhhRTGYpjdI2Tu4faP1Js52HMKWQvk+eU5ipnK0 sr/7I3xuGhUwHBaV0qM3xMuf5cL/ZbK7NFyqmcmN+62AcItkRB8kG8EqgtWMA0TMYyTG BBKKCdUPNZqbDkfxTqd6gSKqCSsr3w2lAzQaUdcW4IPab/SqjROANDdK9IOeSMsfmBGC wx+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sKdsOjfZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id r12-20020a170902e3cc00b001cc5505fffdsi12196ple.644.2023.10.29.15.57.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 15:57:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sKdsOjfZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id DA9818080E31; Sun, 29 Oct 2023 15:57:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231217AbjJ2W4Q (ORCPT + 99 others); Sun, 29 Oct 2023 18:56:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231506AbjJ2Wzu (ORCPT ); Sun, 29 Oct 2023 18:55:50 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2F7310EA; Sun, 29 Oct 2023 15:55:16 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1766CC433C9; Sun, 29 Oct 2023 22:55:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698620112; bh=cfI29PQJSiYahbkvtclk8BjJZ5sHHb1RQDEd7GQkkuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sKdsOjfZYpUlvlsdpKo9utpvZt2kSOfdGUqQAsGvT37obDoPN8IyTAGrS0Au/4S9m euwxuLWQ4SV+SKkNiXmBtBH6BbYI5tQzIu+bGDTI1GIIM6YUuJ+1mF96oGMEVHIV+t vuxkdHq/5T+Y30K49Rgi9AemjESMconnM5zk4pD0Vqwqk0BKP6LOhbYuFeODyZSDiM KavfT240wOaS94Q/+SdjQ64TFyS07Z8nVF+XAyd2h8fxPCFvQQtmReWM4JAsSplz0d 8cQc2dOlbjr29Yxf3dzFeZv9YCIblSFrQPspqf2MzEvQfBgCIAmQWX2UXb0X3j50/2 BdsPQG4KVss/w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ma Ke , Steffen Klassert , Sasha Levin , davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 6.5 20/52] net: ipv6: fix return value check in esp_remove_trailer Date: Sun, 29 Oct 2023 18:53:07 -0400 Message-ID: <20231029225441.789781-20-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231029225441.789781-1-sashal@kernel.org> References: <20231029225441.789781-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.5.9 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 29 Oct 2023 15:57:34 -0700 (PDT) From: Ma Ke [ Upstream commit dad4e491e30b20f4dc615c9da65d2142d703b5c2 ] In esp_remove_trailer(), to avoid an unexpected result returned by pskb_trim, we should check the return value of pskb_trim(). Signed-off-by: Ma Ke Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- net/ipv6/esp6.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index fddd0cbdede15..e023d29e919c1 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -770,7 +770,9 @@ static inline int esp_remove_trailer(struct sk_buff *skb) skb->csum = csum_block_sub(skb->csum, csumdiff, skb->len - trimlen); } - pskb_trim(skb, skb->len - trimlen); + ret = pskb_trim(skb, skb->len - trimlen); + if (unlikely(ret)) + return ret; ret = nexthdr[1]; -- 2.42.0