Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2422748rdh; Sun, 29 Oct 2023 15:58:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjHeUeBwbZtikdjMwo7NRfplFoi7akKyhqUXRmUFc9LJS9VtGUULmcKUNsNCBZ3qdO0kxh X-Received: by 2002:a05:6358:7e47:b0:168:e522:2b55 with SMTP id p7-20020a0563587e4700b00168e5222b55mr10360209rwm.22.1698620287212; Sun, 29 Oct 2023 15:58:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698620287; cv=none; d=google.com; s=arc-20160816; b=wTEXzDEgl4v+9oggbpnwSofoiisRzJe9fnmSXLv9zV6JJFIvVKDgxAVFF2ZbRwqs2k b3qokd404bLdnbO0oaaLF6HTsPt9bsqXGyq2vVDBNVoQsTBLXlcYPrAuvMQtekz6602x NC+Hvqi3zgFg7zJ6YYQqNSI5OI+INVauTukSqYGKIyfxunYk6AA1qjlqBx5vPhDCAv8d QPwOB2WBJb8eQrGcLmzniPhpr0BvzZX1XTzjfoZKP/i8Blcjtu/qH74WELOGQJwLwXpa LiJZKmd5ovQazXHviqAigKYF6NKfhN1VYFBR8AO5mOLdQw8ifS/J0gsOB09nH9KYO56y Rksg== 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=YlIdHAzQOARZ8/grBrj+B65bQhG5sa1oYIOFFg2y8/Q=; fh=rN/4mc0gikGsCZZKxpbnin4Jsbhqwf5UmoityTExS9w=; b=QBpDqD+d6SjHBSzXMV47dhOJXHZlKUBnnu98eklLloKQsPEeAY1YMFR6GorrhkIhUQ sDygxzHN2pVanm9VfkhfszqVvga/Edgjxesq/+s7fZW6sd1iSdcSTWo+9MyhqlGMdrTr egjM+UZ6oxFZIrL4eOlZYbs+CZYA53vZ/yj4ELl8ZkK3CdXpv7P+w3zJ9vMLQK1qChTG HtRBRLyx4IzDPQKwIQboYXwp6drIAHAqFSU3dTO6/vkGoJeJCncLYJlOSDUZQcin/dBB NotVy9Nbx6uLN51f97zGmwHOuy22gMO0BB8y8UngX7B+LaYej3F1M1HfutXI/YRGOj4E ev+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fIFZGbWd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id y23-20020a17090abd1700b0027748734bb9si6004137pjr.148.2023.10.29.15.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 15:58:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fIFZGbWd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 155F1805DED9; Sun, 29 Oct 2023 15:57:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231267AbjJ2W4b (ORCPT + 99 others); Sun, 29 Oct 2023 18:56:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231545AbjJ2Wzx (ORCPT ); Sun, 29 Oct 2023 18:55:53 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F3901704; Sun, 29 Oct 2023 15:55:18 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C83A2C433CA; Sun, 29 Oct 2023 22:55:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698620113; bh=eUjcKlQkiQMmDAOJsdJAc0CFl7asc0wPC/b06ukdS4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fIFZGbWdt3N0ThmGHT3m5CKkwIbCsREQJVVNo8/k1KWsqkl7ovV81RRIOmMTVDeDQ EqmdB0x4oy3Tl1mQwx3aqzakJff83zR9NqLPDWQUx7m6zKD5WDv+Wte8U+sK3ezGbY 9LBIdR8ILXcC4RD/c4IHTEWyxoFEox9htsaoguuqKKMfx0bN7YXDndI+ww/sZoTm2I qHlHO37c7mhku5piIUFRFWQbRMi977DJd7o+j7x1Er/hJUxhSEXBMVUMlZa1xFzdSp SavP2pUoo2g1RfQN7rr1ZMX9kT0IZXdOnxfQWaY/8M8qGVKNSiMZs0TiJHqM3ItZbb F7Z/aGOgRUxsg== 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 21/52] net: ipv4: fix return value check in esp_remove_trailer Date: Sun, 29 Oct 2023 18:53:08 -0400 Message-ID: <20231029225441.789781-21-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 pete.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 (pete.vger.email [0.0.0.0]); Sun, 29 Oct 2023 15:57:02 -0700 (PDT) From: Ma Ke [ Upstream commit 513f61e2193350c7a345da98559b80f61aec4fa6 ] 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/ipv4/esp4.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 2be2d49225573..d18f0f092fe73 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -732,7 +732,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