From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 5F8E83A5E89; Tue, 16 Jun 2026 18:45:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781635548; cv=none; b=OJq1dn7uv7NdlGxaADj27SoZ6dxX2Rtc4NicSeeq5hM1IwTzKkcw7i7cxrE2U1Z3VO3GshUScqitkOgXY+ulEV71W2dm0z7JuWC8fFfJdXaT/NLhfOGE/r4UYFH/3jb+NWyj7MOJM20XOD2CSL7eDDDiG6PEjJHKPAQOM7c0Jjo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781635548; c=relaxed/simple; bh=KCg1MyOFwuYz9zRQrieRBFN0rwqv3ICMRxIPiAOX/EE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JwDtnlaQyGeYnu1Sm9AL1mx21Ur9MZpk4en1GoQ1vmAzMIivrpHhFM5/T5DTP0pyW+OqRrWjZ90/zC1VOfL8GqdqgHNSPrWCoNyLC2nmdOkajAF9Yd1PbUY/7qJV6jIHUDJuDwFHHZ6fDHlZdBqle1zsxzxq2/IOViDpADp1SLo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=AwILjh9t; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="AwILjh9t" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C58901F00A3A; Tue, 16 Jun 2026 18:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781635546; bh=Gq3/NTOyJAmuG8PhKCbAF7XV7OMOwlmHisD1+zUUGJQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AwILjh9t2+W358+81hSTAcOVNeDEdGl1IOoWh8o29uS5nDbbGEOSwRJD7cRzh9yyQ SrSLUhcWQ4v08OSJOVh8BxF/Gvs0IvhSaHAC6A9XThLGdx1ijDRTY336SKK68b4sLD 27INY3YFPhjTDDGgZWMMZDNUmQLEP3qZA5KSt7r0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable@kernel.org, Yuan Tan , Zhengchuan Liang , Xin Liu , Yuqi Xu , Ren Wei , Jakub Kicinski Subject: [PATCH 5.10 069/342] bpf: sockmap: fix tail fragment offset in bpf_msg_push_data Date: Tue, 16 Jun 2026 20:26:05 +0530 Message-ID: <20260616145051.460345577@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145048.348037099@linuxfoundation.org> References: <20260616145048.348037099@linuxfoundation.org> User-Agent: quilt/0.69 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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yuqi Xu commit f72eed9b84fb771019a955908132410a9ba9ea3f upstream. When bpf_msg_push_data() inserts data in the middle of a scatterlist entry, it splits the original entry into a left fragment and a right fragment. The right fragment offset is page-local, but the code advances it with `start`, which is the message-global insertion point. For inserts into a non-first SG entry, this over-advances the offset and leaves the split layout inconsistent. Advance the right fragment offset by the fragment-local delta, `start - offset`, which matches the length removed from the front of the original entry. Fixes: 6fff607e2f14 ("bpf: sk_msg program helper bpf_msg_push_data") Cc: stable@kernel.org Reported-by: Yuan Tan Reported-by: Zhengchuan Liang Reported-by: Xin Liu Signed-off-by: Yuqi Xu Signed-off-by: Ren Wei Link: https://patch.msgid.link/8b129d10566aa3eb43f61a8f9757bcf51707d324.1779636774.git.xuyq21@lenovo.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/core/filter.c +++ b/net/core/filter.c @@ -2845,7 +2845,7 @@ BPF_CALL_4(bpf_msg_push_data, struct sk_ psge->length = start - offset; rsge.length -= psge->length; - rsge.offset += start; + rsge.offset += start - offset; sk_msg_iter_var_next(i); sg_unmark_end(psge);