FAILED: patch "[PATCH] gve: Block invalid ring sizes when device options are 0" failed to apply to 6.12-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x edc9a730ad3c98662047a76db2d7f26ea4350b2e
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026112543-engaging-jailbreak-1e71@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From edc9a730ad3c98662047a76db2d7f26ea4350b2e Mon Sep 17 00:00:00 2001
From: Pin-yen Lin <[email protected]>
Date: Mon, 9 Nov 2026 18:20:35 +0000
Subject: [PATCH] gve: Block invalid ring sizes when device options are 0
On older device versions, minimum ring sizes in the device option are reported as 0. The driver imports these 0 values, allowing userspace (ethtool -G) to request invalidly small ring sizes.
This issue was discovered and actually triggered by the drivers/net/ring_reconfig.py selftest (ringparam test case). Halving the ring size down to 1 triggered a kernel NULL pointer dereference in gve_tx_alloc_rings_dqo():
BUG: kernel NULL pointer dereference, address: 0000000000000002 RIP: 0010:gve_tx_alloc_rings_dqo+0x1c4/0x510 [gve] Call Trace: <TASK> gve_queues_mem_alloc+0x29/0xa0 [gve] gve_adjust_config+0x1b/0x140 [gve] gve_set_ringparam+0x1f4/0x250 [gve] ethnl_set_rings+0x260/0x440 ...
Fix this by falling back to the driver's default minimum ring sizes (GVE_DEFAULT_MIN_RX_RING_SIZE and GVE_DEFAULT_MIN_TX_RING_SIZE) whenever the device option reports minimum ring sizes as 0.
The device reports either both minimum ring sizes or neither, so a single fallback for both is sufficient.
This change was tested using the DQO RDA queue format.
drivers/net/ethernet/google/gve/gve_adminq.c +3 -1
@@ -191,7 +191,9 @@ void gve_parse_device_option(struct gve_priv *priv, *dev_op_modify_ring = (void *)(option +1 );/* device has not provided min ring size */ -if (option_length ==GVE_DEVICE_OPTION_NO_MIN_RING_SIZE ) +if (option_length ==GVE_DEVICE_OPTION_NO_MIN_RING_SIZE || +be16_to_cpu ((*dev_op_modify_ring)->min_rx_ring_size) ==0 || +be16_to_cpu ((*dev_op_modify_ring)->min_tx_ring_size) ==0 ) priv->device_info.default_min_ring_size = true;break ;case GVE_DEV_OPT_ID_FLOW_STEERING :
Sasha Levin
maintainerPATCH 1/1 gve: Block invalid ring sizes when device options are 0
From: Pin-yen Lin <[email protected]>
[ Upstream commit edc9a730ad3c98662047a76db2d7f26ea4350b2e ]
On older device versions, minimum ring sizes in the device option are reported as 0. The driver imports these 0 values, allowing userspace (ethtool -G) to request invalidly small ring sizes.
This issue was discovered and actually triggered by the drivers/net/ring_reconfig.py selftest (ringparam test case). Halving the ring size down to 1 triggered a kernel NULL pointer dereference in gve_tx_alloc_rings_dqo():
BUG: kernel NULL pointer dereference, address: 0000000000000002 RIP: 0010:gve_tx_alloc_rings_dqo+0x1c4/0x510 [gve] Call Trace: <TASK> gve_queues_mem_alloc+0x29/0xa0 [gve] gve_adjust_config+0x1b/0x140 [gve] gve_set_ringparam+0x1f4/0x250 [gve] ethnl_set_rings+0x260/0x440 ...
Fix this by falling back to the driver's default minimum ring sizes (GVE_DEFAULT_MIN_RX_RING_SIZE and GVE_DEFAULT_MIN_TX_RING_SIZE) whenever the device option reports minimum ring sizes as 0.
The device reports either both minimum ring sizes or neither, so a single fallback for both is sufficient.
This change was tested using the DQO RDA queue format.
--- drivers/net/ethernet/google/gve/gve_adminq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/google/gve/gve_adminq.c +3 -1
@@ -188,7 +188,9 @@ void gve_parse_device_option(struct gve_priv *priv, *dev_op_modify_ring = (void *)(option +1 );/* device has not provided min ring size */ -if (option_length ==GVE_DEVICE_OPTION_NO_MIN_RING_SIZE ) +if (option_length <sizeof (**dev_op_modify_ring) || +be16_to_cpu ((*dev_op_modify_ring)->min_rx_ring_size) ==0 || +be16_to_cpu ((*dev_op_modify_ring)->min_tx_ring_size) ==0 ) priv->default_min_ring_size = true;break ;case GVE_DEV_OPT_ID_FLOW_STEERING :
Signature · 1 line
2.53.0