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=1796381036; b=Ywd4D4nmtMeGbSkoZpQBMcH7nYhZrzTHcvNlcagwz5Si8MbBEUpfaRLOKargudfmK0Th OORmiwSJgQ1MS/uHn5X0XEwZ0PfMwc8O0A1mOrjVkgij+6MAypwsvcVfK64jezQ8bN/VV e8AvuKw/qagpVi+mNUfwbKQjeJPQEyrJw77zMD2blPd7ZGYOKuCIanK0yTS4n5VINXpPW 6yjolIH2X0eNANxuJXNgkA1C4JnSmwPVrhe9Ai/T5yLAW9hsNUM4hkkTX9DkyWsjoEfgD ONWRX8N/CQKouxvH7hu1kAuMn6X833JwE97ueTwsNba7CnepeRFJzgT6f+FkdhXh/Tw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381036; 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=kArcoJx7qz/65tQv0iXKWdo2fC7uUEEAqqV8ralupho=; b=CBIKzO0aRLH6lixD3cLa71dBCI5NVpK4wvAnKSuotXLDdMYJLLFjeMI3vjtfbGsw+NYi IkhmCZjhfQth13JG44JL/GZse+/p+BAhm/GlqCiaAmJXZywViMaYaV6Cir3WXsjNgUdLW aexOEuorg2b/4/XlTLqRrUCrWZxy7XGztHpeKkh5W3Fb/H1S3xVlp5XsvAqaylwBCOCIE oArVI96LV6f8Ano1NcQpr5EStDAoYs3W/+2+hWGvbFB2MQfeJuKDRNxnysvy5j2zGSW/F 6UGB75ehuEWVAdfZBMedMFZbQn0c/c7TAQzD/mVKwtbRf1hJRY+YrdVvOOS/uVTfJTw== 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=R5hyBBGy; 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 0C6ED606A32F; Fri, 4 Dec 2026 10:43:56 +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=R5hyBBGy Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A7B21F000CE; Fri, 4 Dec 2026 10:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381035; bh=kArcoJx7qz/65tQv0iXKWdo2fC7uUEEAqqV8ralupho=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=R5hyBBGyL2fQN16JHdXItYRu+KRDblAMuwqIr4TgWrHVvpVvm+SwJvSjTu7mQYWpr mEbUxd10YJMXu7XBU/D+cUuoLxzyPQDdWQZiH/yoRe4RSkuI65qVZeidqHjF1ZTjv4 Bqf3LicgL2t8AwlndjM4DPW3VkyIBKR6HhYDzY7o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Joshua Washington , Amaan Cheval , Jakub Kicinski Subject: [PATCH 7.3 489/742] gve: refuse XDP on queue formats without XDP support Date: Fri, 4 Dec 2026 19:05:53 +0900 Message-ID: <20261204100648.125820328@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Amaan Cheval commit 92c569c28b63067da0276f67f711a3ac20a62aca upstream. Commit d8a8ca14c937 ("gve: add XDP_TX and XDP_REDIRECT support for DQ RDA") enabled XDP on DQO-RDA by dropping the queue_format check from verify_xdp_configuration(), which until then refused every format but GQI-QPL. Nothing replaced it: gve_set_netdev_xdp_features() advertises no XDP features for DQO-QPL and GQI-RDA and gve_xdp_xmit() rejects both, but the core only checks that ndo_bpf exists, so a native XDP program, and an AF_XDP socket on top of it, can still be attached on a queue format the driver does not support. The DQO-QPL RX path was never written for that. Its page accounting assumes the driver keeps a reference of its own across every handoff: gve_xdp_done_dqo() passes the buffer to xdp_do_redirect() and then recycles it with gve_reuse_buffer(), so a redirect target that releases the buffer synchronously, such as an AF_XDP socket in copy mode, can drop the page's last reference when pagecnt_bias runs out. The page is then freed while it is still DMA-mapped and registered in the QPL, and the driver posts it back to the device. GQI-RDA is no better off: an XDP_TX there goes through gve_tx_fill_xdp(), which copies the frame into tx->tx_fifo, but a raw-addressing TX ring never allocates that FIFO, so the first XDP_TX writes through a NULL tx_fifo.base. Refuse XDP setup in gve_verify_xdp_configuration() whenever the driver advertises no XDP features for the current queue format, which today means DQO-QPL and GQI-RDA. A zero-copy XSK pool bind is already refused by the core for the same reason, and a copy-mode bind never reaches the driver and is harmless without a program. Fixes: d8a8ca14c937 ("gve: add XDP_TX and XDP_REDIRECT support for DQ RDA") Cc: stable@vger.kernel.org Reviewed-by: Joshua Washington Signed-off-by: Amaan Cheval Tested-by on v2: Link: https://patch.msgid.link/20261112091451.22969-2-amaan.cheval@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/google/gve/gve_main.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/net/ethernet/google/gve/gve_main.c +++ b/drivers/net/ethernet/google/gve/gve_main.c @@ -1819,6 +1819,12 @@ static int gve_verify_xdp_configuration( struct gve_priv *priv = netdev_priv(dev); u16 max_xdp_mtu; + if (!(dev->xdp_features & NETDEV_XDP_ACT_BASIC)) { + NL_SET_ERR_MSG_MOD(extack, + "XDP is not supported on this queue format."); + return -EOPNOTSUPP; + } + if (dev->features & NETIF_F_GRO_HW) { NL_SET_ERR_MSG_MOD(extack, "XDP is not supported when HW-GRO is on.");