]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
gve: Fix stats report corruption on queue count change
authorDebarghya Kundu <debarghyak@google.com>
Mon, 2 Feb 2026 19:39:24 +0000 (19:39 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 4 Feb 2026 03:28:05 +0000 (19:28 -0800)
commit7b9ebcce0296e104a0d82a6b09d68564806158ff
tree27031f5b9ac047922a2496314b2454fb05cc8118
parent6788d44b936c7e494b0d179c8843a72188287473
gve: Fix stats report corruption on queue count change

The driver and the NIC share a region in memory for stats reporting.
The NIC calculates its offset into this region based on the total size
of the stats region and the size of the NIC's stats.

When the number of queues is changed, the driver's stats region is
resized. If the queue count is increased, the NIC can write past
the end of the allocated stats region, causing memory corruption.
If the queue count is decreased, there is a gap between the driver
and NIC stats, leading to incorrect stats reporting.

This change fixes the issue by allocating stats region with maximum
size, and the offset calculation for NIC stats is changed to match
with the calculation of the NIC.

Cc: stable@vger.kernel.org
Fixes: 24aeb56f2d38 ("gve: Add Gvnic stats AQ command and ethtool show/set-priv-flags.")
Signed-off-by: Debarghya Kundu <debarghyak@google.com>
Reviewed-by: Joshua Washington <joshwash@google.com>
Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20260202193925.3106272-2-hramamurthy@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/google/gve/gve_ethtool.c
drivers/net/ethernet/google/gve/gve_main.c