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=1796382409; b=vS6Xq8t9GIEhGmb2QQUn4ad6QYuLd4rIlZVkfj/gPEwcRkjqbv7aviFtyMNgTqjc+dew DcwkFpXhS7shHGQV++0gVaB0q1+MT2CTIB//r3dKoWqoDvbYENl2HIKuJCalKWYwo2cVo 6HutSAUonQ33fc7A5BTrvVYBQBa/XFXUI+hiKnywHI9cpeD+FNwE0JzjN50SPVpD2+eLU blM93FvvGWqj4d1wv0tfEUdCb1ErtOHFQSRhrKaAxGTNOWiBmcFSdu1aqp79VO0WDMijF /IJIY65M2uFVat3U7mKRUdw5kD3i7dgQk1C923Da97QFhTMwOg/pPQGHzszLh7owObQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382409; 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=+uH+Xj6daYoTwSiOjYMca2u77bCtsmck2AIqQ/IB73c=; b=MfuNx0ndNJN85IIyscKEitjDcHl4prVTy2Z+k7LxwcWo8zOwWItbhUZYncb9tKTeweY8 G43OKAQtLFJs9yRyPT1JieaaFHrXo5n9Xm66dkJ9j+FDzBgYjvvr4TvxDgRGXoXxls7Kv JZLimXi2NDuuv6sSXsRjKcNulOU3wD+4pyQKchwSIu6X+hfFWBKWatjimkNWYnl1A09+z QZDqtnuKBLTZNfWkonU0pfpnlOhZGFC07uYzJmEarLe2UKuM1UzfMSpJsYuP8JSjK8+cF ZRO6qWF2Mx2Ve4DZn/WELS0i4Yoj4bIwQ5OjZtNn9SDAegwGLAT62iNmgaw/xu6YESg== 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="BH/eUxVx"; 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 25632606A32D; Fri, 4 Dec 2026 11:06:48 +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=BH/eUxVx Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52C631F000C2; Fri, 4 Dec 2026 11:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382408; bh=+uH+Xj6daYoTwSiOjYMca2u77bCtsmck2AIqQ/IB73c=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BH/eUxVxgmOUzVdH1ALU57WaI/7vQln18CmVr2/Rb8iwHWtHkDDwT0CSggjtScJ1Q BUV2aBI2QWqQKg49vXYR7QPZtRH96X42Gasb2jxNQ9kWEuliM2Mm2jFt+fmfFpzd3u q6V9hXesy71u/DPDs3r/8vEVtTeexWvSv9DxaroM= 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 6.18 440/703] gve: refuse XDP on queue formats without XDP support Date: Fri, 4 Dec 2026 19:05:39 +0900 Message-ID: <20261204100639.515005050@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-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 @@ -1721,6 +1721,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.");