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 D7E7D46EF88; Tue, 21 Jul 2026 20:20:25 +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=1784665227; cv=none; b=BZudB1Zq5pF/Pf2NsZjg3cDeEMS116oYdbdvIIhAG2BGGJAICuXof4tmUptyo0MembB/z3z768/v9HZd5VTcPBcU1X1BtbDG98FYEEsqsGyycytDNVy0RbOIlrm3IMmBgDlHpCPc/sbuB8gXbzwYqxnTnSOsrx+kwKNcda5uEEM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784665227; c=relaxed/simple; bh=n2BJncSplqsJeOmDHFPN8aGfflSFhw5pCl+OhWCxc7c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Zyyc9UFeavt3pDERaVFtuqEqygqcpMrrDVdtgeI1Uz6qefSPwan8MS+/vv6xRxzkALhqBV1s62gc57ymz2y8cAWwZy7H5hj7thxgQNb38znvjcyiBAEIzWvVvQHPd1quuQ4YduqhmiFcB5cP/USISENQ6CpD+WEAsyjGHT3ami8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=jxsXssjV; 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="jxsXssjV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4ACF41F00A3A; Tue, 21 Jul 2026 20:20:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784665225; bh=aORy7ZcAjfd7eis9dIvuuWvxoTiZe+KfRuwqQFIRPKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jxsXssjVX3uB+NmJgxqZZ07J4Y/InKzinlEg1HKl8ewoptiWR7AfHZt5nqhsk/Mzi z75MMWccVIqM1PCBzkB11DN1pGNHzZl7+XnkZgUS8jxNPolujU7aAm9935ZHC+TZan pcxm/OEGN6ZDSAhmC3nUkfoiAb/jQn5psyUftQBA= 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 , Zhao Zhang , Ren Wei , Emil Tsalapatis , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Alexei Starovoitov Subject: [PATCH 6.6 0222/1266] bpf: Reject fragmented frames in devmap Date: Tue, 21 Jul 2026 17:10:59 +0200 Message-ID: <20260721152446.786149010@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152441.786066624@linuxfoundation.org> References: <20260721152441.786066624@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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhao Zhang commit aa496720618f1a6054f1c870bf10b4f6c99bf656 upstream. Devmap broadcast redirects clone the packet for all but the last destination. For native XDP, that clone path copies only the linear xdp_frame data, while fragmented frames keep skb_shared_info in tailroom outside the linear area. Cloning such a frame leaves XDP_FLAGS_HAS_FRAGS set but without valid frag metadata, and the later free path can interpret uninitialized tail data as skb_shared_info, leading to an out-of-bounds access during frame return. Reject fragmented native XDP frames in dev_map_enqueue_clone(). Add the same restriction to the generic XDP clone path in dev_map_redirect_clone(). Generic XDP represents fragmented packets as nonlinear skbs, and rejecting them here keeps clone-based broadcast support aligned between native and generic XDP. Fixes: e624d4ed4aa8 ("xdp: Extend xdp_redirect_map with broadcast support") Cc: stable@kernel.org Reported-by: Yuan Tan Reported-by: Zhengchuan Liang Reported-by: Xin Liu Assisted-by: Codex:GPT-5.4 Signed-off-by: Zhao Zhang Signed-off-by: Ren Wei Reviewed-by: Emil Tsalapatis Reviewed-by: Toke Høiland-Jørgensen Link: https://lore.kernel.org/r/21c2d153dd25603d359069a02bf06779b51f6423.1780385378.git.zzhan461@ucr.edu Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman --- kernel/bpf/devmap.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/kernel/bpf/devmap.c +++ b/kernel/bpf/devmap.c @@ -558,6 +558,10 @@ static int dev_map_enqueue_clone(struct { struct xdp_frame *nxdpf; + /* Frags live outside the linear frame and cannot be cloned safely. */ + if (unlikely(xdp_frame_has_frags(xdpf))) + return -EOPNOTSUPP; + nxdpf = xdpf_clone(xdpf); if (!nxdpf) return -ENOMEM; @@ -703,6 +707,9 @@ static int dev_map_redirect_clone(struct struct sk_buff *nskb; int err; + if (unlikely(skb_is_nonlinear(skb))) + return -EOPNOTSUPP; + nskb = skb_clone(skb, GFP_ATOMIC); if (!nskb) return -ENOMEM;