From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97DB5C00A8F for ; Mon, 23 Oct 2023 11:36:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234140AbjJWLgW (ORCPT ); Mon, 23 Oct 2023 07:36:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234130AbjJWLgS (ORCPT ); Mon, 23 Oct 2023 07:36:18 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 098E010C0 for ; Mon, 23 Oct 2023 04:36:16 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44BE2C433CA; Mon, 23 Oct 2023 11:36:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1698060975; bh=w+bOXU3hCsFYvNA0lHOVMutPwzPEeMKqUt/65bUj4H4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nleadUZLmx4Xb0j+Gj6b207x1bEAOy8PmFjwQ+ybcvColnUC7V9P+wvyehf75BicN DS+gP2voi8dl+AQx2lN7GzNkhIzWA2tsnsK0CV7w2zTaJjZpss2GgfxN/CXau3TNoh CYok81taIvTCG3G+wNxsB78ssFlSP9FHwRaIWMJk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ma Ke , Steffen Klassert Subject: [PATCH 5.15 032/137] net: ipv4: fix return value check in esp_remove_trailer Date: Mon, 23 Oct 2023 12:56:29 +0200 Message-ID: <20231023104822.100643159@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231023104820.849461819@linuxfoundation.org> References: <20231023104820.849461819@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ma Ke commit 513f61e2193350c7a345da98559b80f61aec4fa6 upstream. 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: Greg Kroah-Hartman --- net/ipv4/esp4.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -739,7 +739,9 @@ static inline int esp_remove_trailer(str 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];