Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp723123rdb; Fri, 6 Oct 2023 18:02:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2cdZIzhaml+ZQLSh9gGb/s1z1zwssed0/Xr7g7QbPZ5/LbGIwtYvtozk8m/0WmLH/Y5Qa X-Received: by 2002:a17:902:b282:b0:1c6:2780:3ad1 with SMTP id u2-20020a170902b28200b001c627803ad1mr10163879plr.57.1696640548994; Fri, 06 Oct 2023 18:02:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696640548; cv=none; d=google.com; s=arc-20160816; b=DNnVWTF4RSliajdIfRx1RFeOkRY5FH6wYaloa0Ry/e+yObAX/W25WlZpokgD5JqMmn FE/cXEEpFa2ctYwK6uETb2QdDIjy0MLg77PRKx+8H/RyEU3iKWbqqKW72IM4aEulZcmF 4W7OaVPz9RsxCv/DhLmACq2emyk3i58MRJ9eUI5HMPNNYTtVzM65YbW7hLC5ZRcv8elw 348wpMb/lpBQQuQI1qsufEc9Sh2M/mpfGcBzkguAhjR3GnUb/16CXEbJRuXw9iQ75RhV F6sfJUjDEEMkitm8X2FZOUUCymjHY2LeEVNR41SPQ/f6K4P34ZVhfXJPUysIqF8auCDj BhJA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=C1iUtQXJHDHL2bLy/guQSpAx1+CMVbpIrJoept/H6sM=; fh=ilshV503a7lbgcM56KQ3Px5LBVG+9Aztvu6SfZIq0a4=; b=VcNn7V6G3c+xztxstMnXzoBxUbXuN3WkblTv9pcnACKa/qzkrtzYKHS5cZJx1ACTNw h1H3j1Hb9rK5pBdG6dfiHj3eKhXnQIzqdyaP0rQDPjm+C0tAqzvlo1UJHOTHKIwL32zS HYiKb6oAzEKQWifDu6PHsTrkIW5Ai70MwnZfvMIWO9YED5BUcyeeall8VnEYbsDPQy6u zgDnwxgVRKzCjBdhbD1051FrdE1CCcby2snO55i/EmMhHdCNka8MOOWRJ6TNAPVvNTTM ek9Yemg4w5FNoGYIOc3p3i+P4CDCFliMIVaIR8osIpmHXQiLGA3E+vaaYmCKXZF8doEb tnDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=gWy5TQoj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id kn6-20020a170903078600b001c41515c4c7si4616444plb.115.2023.10.06.18.02.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 18:02:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=gWy5TQoj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 838FC819F9A4; Fri, 6 Oct 2023 18:02:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233997AbjJGBBl (ORCPT + 99 others); Fri, 6 Oct 2023 21:01:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233994AbjJGBBg (ORCPT ); Fri, 6 Oct 2023 21:01:36 -0400 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 83C52B6; Fri, 6 Oct 2023 18:01:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=C1iUt QXJHDHL2bLy/guQSpAx1+CMVbpIrJoept/H6sM=; b=gWy5TQojfPdZcHwTYEjpK 3mmV/t0FcLRVPemluFhFeoY5rDQBhgRIxXk4qfCsfs2fiov4+wZe/Xf6tFy1k8xX lLdB08TFbSijxcU3fYF9dUulDdueMy9uCrakOrJnzDT8hkGZQl1xlqKFsIPanRZy 2VReAZ2ybmfiDu4/LKpils= Received: from icess-ProLiant-DL380-Gen10.. (unknown [183.174.60.14]) by zwqz-smtp-mta-g4-1 (Coremail) with SMTP id _____wDn+46KrSBl6sNMEA--.49925S4; Sat, 07 Oct 2023 09:00:04 +0800 (CST) From: Ma Ke To: steffen.klassert@secunet.com, herbert@gondor.apana.org.au, davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ma Ke Subject: [PATCH] net: ipv6: fix return value check in esp_remove_trailer Date: Sat, 7 Oct 2023 08:59:53 +0800 Message-Id: <20231007005953.3994960-1-make_ruc2021@163.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _____wDn+46KrSBl6sNMEA--.49925S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrZFyUXr4rXr18Zw18Zw45GFg_yoWxtFg_Ga 9rXrWkWr18uF4kAw4Svr42vFy5trW8ZFWfZFyft3yfZw17Aw1rJrs7urZ8ZrZxGas7Cry3 CFsxCrW7t34SqjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRKfHUJUUUUU== X-Originating-IP: [183.174.60.14] X-CM-SenderInfo: 5pdnvshuxfjiisr6il2tof0z/1tbivhcCC1ZcjAANoQAAsK X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 06 Oct 2023 18:02:24 -0700 (PDT) X-Spam-Level: ** 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 --- 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 fddd0cbdede1..e023d29e919c 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.37.2