From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796389181; b=vHBP9dVvzRKI8ND0U/WeyoGSZS8FnztrLUPsBVFYUyIvfvKH3h/XKyD0UFrEccigJDqt 5cSyWjRYbyE+o66+JXxuagUSvyIwFhGpMy/Ev7P0EPI9Ivl1We5/30AWdSHGJg0A2qv22 NUB+/dwZQHpVaJj+psiNNqK3t+e9PlkQv7espTRdx42A/f44fRUMII9HOELsEy+lGY0p+ AmQq23CA2Lc6SH6BuZspLpCdMBa3HB3AZyLeCSS3aWDPtkjUKnWBuclkNmB5PByXYp7eo U8saEYROUIEMTKV2A8AlESdq7yYldFfm25zFxzadEmGn3V2FhEdRQRetk8aFwYD51qg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389181; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=UhhhOqXh17eaEHOxuvJ1rqAL0UzE7VGLukBpyGDmr88=; b=facMW+VXisKvP3cb+vdW7c0vzpqDc26ez1svVkQEAzM0WMoTEkXVkXJTBmXC+X7Dv9zu kZPxMIdc58OsowK0vJdxljso2IVHE1i3faAps4JspNK3rZ7VCPFLwP5hrEQL6+HkQLgMh c5Bvh77bPGFYnTu1+1T4+MqWTIR9PCm8SLEV+4fFsmKkHjADTv0Y2zO5i8OrSXilimqvz uabTFlnELnPdzLViVy+q4s9VtFwzZi/iCNwCRBIFk9YiyS1yTQnciIeZLWemHEqs5X2ts T6qp94w47J6rXNlY2QERiAgOoZn4lZwFtpeeEiUFWmDkhQlTm2Ycma7y73vpEZj7Icg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=fFjDMltC; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1694C606A322; Fri, 4 Dec 2026 12:59:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=fFjDMltC Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2D8A1F000CE; Fri, 4 Dec 2026 12:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389180; bh=UhhhOqXh17eaEHOxuvJ1rqAL0UzE7VGLukBpyGDmr88=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=fFjDMltCqeGGmV+EfRc1GHsjLBgAJuIVGY9XYiyUMV72hVCqVujEBaTaKOLW+D6fW xoKHw/LY1Am4oHjo30hbtWNuOfx8YEgD+ijXIEkCnnVoLGAgKvNDIRmCbZvpWs4QQ+ TQ5Ca7jO6GbNWIa1jIszJ5pAzqVlOdJV3XZJN1qs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alexei Starovoitov , Sasha Levin Subject: [PATCH 6.1 0887/1059] bpf: Keep the MAC header in bpf_skb_change_tail() Date: Fri, 4 Dec 2026 19:06:58 +0900 Message-ID: <20261204100706.989122916@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexei Starovoitov [ Upstream commit 28ffeb9cb9722f39854f11e5f0511a4a8c12d9fb ] The least length of the skb is the offset of the transport header when it's set, also when that is below the offset of the network header. Callers of tc programs count on a skb that is not shorter than mac_len. Take the bigger one of the two offsets. Fixes: 5293efe62df8 ("bpf: add bpf_skb_change_tail helper") Signed-off-by: Alexei Starovoitov Link: https://patch.msgid.link/20261125032938.670542-44-alexei.starovoitov@gmail.com Signed-off-by: Sasha Levin --- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/filter.c b/net/core/filter.c index d4a3da83d33d2..22a94e1c76970 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -3827,7 +3827,7 @@ static u32 __bpf_skb_min_len(const struct sk_buff *skb) if (skb_transport_header_was_set(skb)) { offset = skb_transport_offset(skb); if (offset > 0) - min_len = offset; + min_len = max_t(u32, min_len, offset); } return min_len; } -- 2.53.0