From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9B740125CA for ; Mon, 23 Oct 2023 11:00:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="fEbPUUr/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17134C433CA; Mon, 23 Oct 2023 11:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1698058818; bh=cIjASlBtvLd+gcONiCfNOrup40dPj9TTatlJIA5eiE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fEbPUUr/Il1L8Y5egWR5wC92m1UZlbxU3XB929sVpHkJHg+X13lzma3Uijxp/POiC ij7ns5ON8UAVR/srWgb5P+CFt5G77sCTcpFDT9gUSslN8OhG3xFY4pjy13FBj1ZUMn f1M8pxO04V0/pms5ljNl/wgPbH3Gpl71EK3H45vo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ma Ke , Steffen Klassert Subject: [PATCH 4.14 37/66] net: ipv4: fix return value check in esp_remove_trailer Date: Mon, 23 Oct 2023 12:56:27 +0200 Message-ID: <20231023104812.223571863@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231023104810.781270702@linuxfoundation.org> References: <20231023104810.781270702@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.14-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 @@ -547,7 +547,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];