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=1796387023; b=lLOUtoPIK7zjgFVeTW3G8GdhJS1QAHUp2xx8AWM1z1YeGQJ9De9vTaxnBYZfHTY4KWb9 EKXLlPUBTy2/6EUkepdBjPGoC3uIY2lmgQpkzSFxiDE5zsQ1UrYhakvsoBtT8uehzTmg/ mbAJJCVF/eKbqRKaSWsVxjquEB54bBEBhACIfMTNRf8jMrW+VthIAKLA9Gr0McYGlm4+g ZhyJfyDiliQoXprYkS7/LyucYoeoW4I+MPqm+wXpcAtrXVFq33t74PtKRveLckZ67c7Yd HSfEI8tdQmXoFnKViUaDRIpC+wEh7dhJwZdaKF8PNU6tPtWZym5lsVzCQlQ2fr6vwLg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387023; 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=aG+PohhMmgxMCkUXEpNVsH3b8AwtJfv3jUouWPsB0K0=; b=PEhj/XPKLudYisk3YjiCp/b+xWfQ8b486tRACFS8CV6uqmOWTPJoNOnP0bk2mWUv0uBo UL7HWKFUSKoT3GMyAdu83xLFmzsFb4B/HwgO26OZyUmqwPYkLxtgi9R4JePQyK2EZWxq2 vutecA0BvYB57RbyVIoxxus9H2jUQq7Eh7TxyaJPR/tNiPskaGfmBg9mnCH3Zr9ScZM5+ BwNe4JguJfRKzWPAMRVI0wy/lxscAbpjrLYCvtlGEePWiTsQFCrXzCTnat2C3ABarCkMr cmaWbQaoRCLXL4C079u94EptI7dFk2H69meqPS65ELXM/XV5pGKWJ5vtYN1WscQYHzw== 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=SgN0O5c4; 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 9C6C0606A330; Fri, 4 Dec 2026 12:23:43 +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=SgN0O5c4 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 196861F000C2; Fri, 4 Dec 2026 12:23:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387023; bh=aG+PohhMmgxMCkUXEpNVsH3b8AwtJfv3jUouWPsB0K0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SgN0O5c4P/4ANVaPWs9hFE2CMRRlZDVlf27PwfHIM8kKQbne5T7a5bYa7NeqKbmQ4 udkTqyZpD99eRQypAKD9MuNFiGmFZhl4H2vluFOLfkci1jiQVXdculaSOUvZblLYpN Wk+wSe88UgqlRJIqiaZGd99DdstTdf85BsDQ593I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Lorenzo Bianconi , Paolo Abeni , Sasha Levin Subject: [PATCH 6.1 0064/1059] net: stmmac: copy XDP metadata in AF_XDP zero-copy RX Date: Fri, 4 Dec 2026 18:53:15 +0900 Message-ID: <20261204100645.748812765@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: Lorenzo Bianconi [ Upstream commit 41d78e9ac0984f0e9577e5312e62400b5a6760c8 ] stmmac_construct_skb_zc() reserves headroom for the XDP metadata and records the length reported by the XDP program, but only copies the packet data starting at xdp->data. The bytes in [xdp->data_meta, xdp->data) are never copied into the new skb, so the skb advertises metadata that is not there: after eth_type_trans() anchors mac_header, data_meta points at uninitialized headroom instead of what the program wrote. Copy the metadata together with the packet data starting at xdp->data_meta, leaving skb->data at the start of the frame and the metadata immediately before it, and record its length. This keeps data_meta valid for the stack and TC BPF after eth_type_trans() anchors mac_header. Fixes: bba2556efad6 ("net: stmmac: Enable RX via AF_XDP zero-copy") Signed-off-by: Lorenzo Bianconi Link: https://patch.msgid.link/20261027-stmmac-xdp-fixes-v2-4-10eae8a093a8@oss.qualcomm.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 97b4f04ded839..a4eb6089dfbb1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4981,7 +4981,8 @@ static struct sk_buff *stmmac_construct_skb_zc(struct stmmac_channel *ch, return NULL; skb_reserve(skb, xdp->data - xdp->data_hard_start); - memcpy(__skb_put(skb, datasize), xdp->data, datasize); + __skb_put(skb, datasize); + memcpy(skb->data - metasize, xdp->data_meta, datasize + metasize); if (metasize) skb_metadata_set(skb, metasize); -- 2.53.0