From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp9.goneo.de (smtp9.goneo.de [85.220.189.104]) (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 93AAB38888F; Sun, 7 Jun 2026 13:50:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=85.220.189.104 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780840264; cv=none; b=oWRWUzn+A0XIFCdcTqlRTORa65Zl/Tl202kMqmH/NN/lcbeXmAXDukrBYGOxWSCx13ULsSZ9d6FygV754AUPDtjp7QkjHYxg3wYWH346lyXw/Eq1gGwwnya3pUtTcVjxBwab5O76xB/vnkVcOgGL09RU+Wuub9rbQTFBXwJhAjE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780840264; c=relaxed/simple; bh=2no5ts4uR+BRFpbAeaMDuXoBtDm87qzy992Y6dadpc8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tEJGEES07JqAPaErgg/1R99OClcC3Kvb2vGercJo2N9RuLeJYMlEFVJOHTZ8PnVKY5NfbNBTUm6lvg4RgG/1VAxXuzGmdLJdUMEYqD5O7otE+yGUoNWsB9fN3t9SKgtR7YdOPWKU3R/BFtgjBK0fBUze8YHj17CvM7Isb2xQwuE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tk154.de; spf=pass smtp.mailfrom=tk154.de; dkim=pass (2048-bit key) header.d=tk154.de header.i=@tk154.de header.b=AbMnEkob; arc=none smtp.client-ip=85.220.189.104 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tk154.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tk154.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tk154.de header.i=@tk154.de header.b="AbMnEkob" Received: from hub1.goneo.de (hub1.goneo.de [IPv6:2001:1640:5::8:52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by smtp9.goneo.de (Postfix) with ESMTPS id 116812408EF; Sun, 07 Jun 2026 15:50:52 +0200 (CEST) Received: from hub1.goneo.de (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by hub1.goneo.de (Postfix) with ESMTPS id 70AC824033A; Sun, 7 Jun 2026 15:50:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tk154.de; s=DKIM001; t=1780840250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C1Ioe8uKiJIxbIqpXcCQ8i5GRjn3ORGyOB/YwWZ/fog=; b=AbMnEkobfHAq5PfRX3T+71v4N8kdtib3iu7ZqGGyK75dtr/ckY0y3CfiopnFDStDBJRjTq Ekutqb3rv7LWYg7+N7eKyo/UzSu/Zftds7QfJrwITgSU/gADXttL/WD+Usk4mNCevytbQe 7Ar7QJ7QuNzqYQm21gwkWtqaFa0rvWlGIVwTkhDDRV4febIHq0rxcXmwQaaJoh7xGRkgHf a5in/6d8wkU39BKkg9RdhFKjDUPQGh3F9OtqNTzPVrBcQ/MThkPcV5mXQDVtDFU+JhGAjt tU5snU7pzPrIR/J+L4QojIJ3G9nyDky6SuhXT/ONBqM3CbwkNOygKCDfQ9BcrQ== Received: from Til-Notebook.lan (unknown [IPv6:2a00:1f:5743:3300:7fdc:421c:b21a:ba71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hub1.goneo.de (Postfix) with ESMTPSA id CF98C240263; Sun, 7 Jun 2026 15:50:46 +0200 (CEST) From: Til Kaiser To: netdev@vger.kernel.org, bpf@vger.kernel.org Cc: marcin.s.wojtas@gmail.com, linux@armlinux.org.uk, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, mcroce@redhat.com, sven.auhagen@voleatech.de, lorenzo@kernel.org, Til Kaiser Subject: [PATCH net v5 2/4] net: mvpp2: limit XDP frame size to the RX buffer Date: Sun, 7 Jun 2026 15:49:41 +0200 Message-ID: <20260607134943.21996-3-mail@tk154.de> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260607134943.21996-1-mail@tk154.de> References: <20260607134943.21996-1-mail@tk154.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-UID: c363fd X-Rspamd-UID: 09282c mvpp2 has short and long BM pools, and short pool buffers can be smaller than PAGE_SIZE. The XDP path nevertheless initializes every xdp_buff with PAGE_SIZE as frame size. XDP helpers use frame_sz to validate tail growth and to derive the hard end of the data area. Advertising PAGE_SIZE for short buffers can let bpf_xdp_adjust_tail() grow a packet past the real allocation, corrupting memory or later tripping skb tailroom checks. Initialize the XDP buffer with bm_pool->frag_size so XDP tailroom matches the actual buffer backing the packet. Fixes: 07dd0a7aae7f ("mvpp2: add basic XDP support") Signed-off-by: Til Kaiser --- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 92a701f4fe3f..3372ed27cc8d 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -3979,7 +3979,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, else xdp_rxq = &rxq->xdp_rxq_long; - xdp_init_buff(&xdp, PAGE_SIZE, xdp_rxq); + xdp_init_buff(&xdp, bm_pool->frag_size, xdp_rxq); xdp_prepare_buff(&xdp, data, MVPP2_MH_SIZE + MVPP2_SKB_HEADROOM, rx_bytes, true); -- 2.54.0