struct netdev_bpf only carries an extack for XDP_SETUP_PROG. For XDP_SETUP_XSK_POOL, xp_assign_dev() fills in command, xsk.pool and xsk.queue_id of an on-stack struct and nothing else, so xdp->extack is whatever was on the stack. Since commit 091a3b6ff2b9 ("gve: Use extack to log xdp config verification errors") gve passes that pointer to gve_verify_xdp_configuration(), which stores an error message through it whenever the configuration is refused, for example when a zero-copy socket is bound while the RX and TX queue counts do not allow XDP. With CONFIG_INIT_STACK_ALL_ZERO the pointer is NULL and the message is skipped; otherwise the driver writes to wherever the uninitialized pointer points. xp_disable_drv_zc() passes the same kind of struct when a pool is disabled. gve ran the check on that path too until the commit "gve: do not verify the XDP configuration on program or pool removal" removed it, so a refused disable could also write through the pointer. Pass NULL. The queue count refusal is still logged through netdev_warn(); the other refusals are silent on this path. Zeroing the struct in xp_assign_dev() and xp_disable_drv_zc() would also fix this, and would cover idpf_xsk_pool_setup(), which reads extack from it too. This patch fixes gve on its own so that the fix does not depend on a change to the XSK core. This was discovered by an AI code review agent reading gve_xdp() while preparing "gve: do not verify the XDP configuration on program or pool removal". It was reproduced, with that fix applied, on gVNIC in GQI-QPL mode (GCE n2-standard-4) on net at commit ef3e21c61baa ("net/tcp-ao: fix reset key lookup for IPv4 segments on IPv6 listeners"), built with CONFIG_INIT_STACK_ALL_PATTERN, by binding a zero-copy AF_XDP socket at the default queue counts and MTU 1460 with repro/xsk/xsk_trigger.c from the Link below: # ./xsk_trigger eth0 0 Oops: general protection fault, probably for non-canonical address 0xfefefefefefefefe: 0000 [#1] SMP NOPTI RIP: 0010:gve_verify_xdp_configuration.cold+0x1d/0x2e [gve] Call Trace: gve_xdp+0x47/0x4d0 [gve] xp_assign_dev+0x2c8/0x350 xsk_bind+0x1ba/0x4e0 With this patch the same bind is refused with -EINVAL and no fault. Link: https://github.com/AmaanC/sticky-xdp Fixes: 091a3b6ff2b9 ("gve: Use extack to log xdp config verification errors") Cc: stable@vger.kernel.org Signed-off-by: Amaan Cheval --- drivers/net/ethernet/google/gve/gve_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c index 5156259232b2..26b66a2c64b3 100644 --- a/drivers/net/ethernet/google/gve/gve_main.c +++ b/drivers/net/ethernet/google/gve/gve_main.c @@ -1868,7 +1868,8 @@ static int gve_xdp(struct net_device *dev, struct netdev_bpf *xdp) if (!xdp->xsk.pool) return gve_xsk_pool_disable(dev, xdp->xsk.queue_id); - err = gve_verify_xdp_configuration(dev, xdp->extack); + /* xdp->extack is only valid for XDP_SETUP_PROG */ + err = gve_verify_xdp_configuration(dev, NULL); if (err) return err; return gve_xsk_pool_enable(dev, xdp->xsk.pool, -- 2.47.3