Article View: linux.kernel.netdev
Article #7710Re: [PATCH net v3 3/4] gve: Block invalid ring sizes when device options are 0
From: netdev-bot+sashiko
Date: Tue, 27 Oct 2026 01:42
Date: Tue, 27 Oct 2026 01:42
115 lines
12761 bytes
12761 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] In gve_parse_device_option()
(drivers/net/ethernet/google/gve/gve_adminq.c:194-197), the newβ¦
Pre-existing issues:
- [Low] gve_parse_device_option() (gve_adminq.c:177-197) accepts
MODIFY_RING options with option_length 9-11, because it rejects only <β¦
--
gve: Block invalid ring sizes when device options are 0
When the MODIFY_RING device option reports a minimum RX or TX ring size
of 0, this patch makes gve_parse_device_option() fall back to the
driver's default minimum ring sizes. The goal is to stop ethtool -G from
accepting ring sizes small enough to crash gve_tx_alloc_rings_dqo().
> diff --git a/drivers/net/ethernet/google/gve/gve_adminq.c b/drivers/net/ethernet/google/gve/gve_adminq.c
> index 8b215fca9c1b6..2c848f0c23dc2 100644
> --- a/drivers/net/ethernet/google/gve/gve_adminq.c
> +++ b/drivers/net/ethernet/google/gve/gve_adminq.c
> @@ -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;
[Severity: Low]
If only one of these two fields is 0, should the other minimum from the
device be kept?
Both directions share the single default_min_ring_size flag. When it is
set, gve_enable_supported_features() replaces both minimums:
drivers/net/ethernet/google/gve/gve_adminq.c:gve_enable_supported_features() {
...
if (info->default_min_ring_size) {
/* If device hasn't provided minimums, use default minimums */
info->min_tx_ring_size = GVE_DEFAULT_MIN_TX_RING_SIZE;
info->min_rx_ring_size = GVE_DEFAULT_MIN_RX_RING_SIZE;
} else {
...
}
Take a device that reports min_rx_ring_size = 1024 and
min_tx_ring_size = 0. Its RX minimum would become
GVE_DEFAULT_MIN_RX_RING_SIZE (512), not 1024. Before this patch, the
non-zero value was used.
gve_set_desc_cnt() copies these values into priv->min_rx_desc_cnt and
priv->min_tx_desc_cnt. Those are the only lower bounds that
gve_validate_req_ring_size() checks:
drivers/net/ethernet/google/gve/gve_ethtool.c:gve_validate_req_ring_size() {
...
if (new_tx_desc_cnt < priv->min_tx_desc_cnt ||
new_tx_desc_cnt > priv->max_tx_desc_cnt ||
new_rx_desc_cnt < priv->min_rx_desc_cnt ||
...
}
Would ethtool -G rx 512 then pass validation and go to the device, even
though it is below the minimum the device reported?
A per-field fallback would use the default only for the field that is 0.
Could that fix the zero-minimum crash and still keep the other limit from
the device? For older devices that report both minimums as 0, as the
commit message describes, the two approaches behave the same.
[Severity: Low]
This is a pre-existing issue, but can these new reads go past the end of
the option payload when option_length is 9, 10 or 11?
The length check earlier in this case rejects only lengths below
GVE_DEVICE_OPTION_NO_MIN_RING_SIZE (8):
drivers/net/ethernet/google/gve/gve_adminq.c:gve_parse_device_option() {
...
case GVE_DEV_OPT_ID_MODIFY_RING:
if (option_length < GVE_DEVICE_OPTION_NO_MIN_RING_SIZE ||
req_feat_mask != GVE_DEV_OPT_REQ_FEAT_MASK_MODIFY_RING) {
...
}
min_rx_ring_size and min_tx_ring_size sit at payload offsets 8 and 10,
and sizeof(struct gve_device_option_modify_ring) is 12. With a length of
9 to 11, part of each read comes from the next option header or from
unused descriptor space.
gve_get_next_option() only checks option_length against the
device-provided total_length. Also, total_length is never checked
against the GVE_ADMINQ_BUFFER_SIZE allocation.
If those out-of-option bytes are non-zero, the fallback does not fire
and the bytes are used as the device minimums.
The baseline gve_enable_supported_features() already read the same
fields in this case, because default_min_ring_size stayed false. So this
patch does not add any new reachable impact.
Would checking option_length < sizeof(**dev_op_modify_ring), instead of
comparing with == GVE_DEVICE_OPTION_NO_MIN_RING_SIZE, close this?
--
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261023204706.3112215-1-hramamurthy%40google.com
Technical Details
Message-ID:
<179306532757.3134.16501377800126286936@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352169-linux-kernel-netdev=dewy.ruReferences:
<20261023204706.3112215-4-hramamurthy@google.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352169-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v3 3/4] gve: Block invalid ring sizes when device options are 0 Date: Tue, 27 Oct 2026 01:42:07 +0000 Organization: Usenet Network Message-ID: <179306532757.3134.16501377800126286936@kernel.org> References: <20261023204706.3112215-4-hramamurthy@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1442083"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:BIoScgCBeewfkqju0W7vLPHjQqw= sha256:+vG984zUV+4mdntbPiK//pXB5evHj2Ch54NZ5qQ8gcs= sha1:cEILt0M8LzeLnZc3qH7rV8VzPKE= sha256:f1CuPcwAqXViG0y1nVOP9TM6X1cD52KFswk6LHDZisk= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 8150F125BD8; Tue, 27 Oct 2026 04:42:51 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.838 X-Spam-Status: No, score=-3.838 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.339, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vLRgtOLroErN; Tue, 27 Oct 2026 04:42:48 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-352169-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id F1471125BC4; Tue, 27 Oct 2026 04:42:37 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 0A9B96033B2; Tue, 27 Oct 2026 01:42:20 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793065335; b=qUdVbOGOAzocYIkiHjcNFl95U5jehrQ7r/5fAOi0uBb6RenrhIDPmlPjJQMSqlM9M5gK 3nhNFPX7L3X0tkKyghjKS7m1BvXrexv66BmJvwQssNa9E1pN2tNG8PyT8Onke0HuZDgEl zYYdbC/+kdnbigd+LetT0EwyUvIMgq4tfUkcjjnI3wIx2pn0w+u4gsUbfnRCEFZpZyooG 9o2GFaOZCChY19nj4Qkrxc8Jahnxm+h72vNV3lvj7dOZYtUp/ExK+XH1NAnbuJzZW0qBq C9ZxSRqaRK599uFzQtbLisDCW12BKHtr3FuT/RKGU8mcak1sw5Bb4f8r0pMyX6/sXqw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793065335; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=9d/9KitAZXEBwhLTbhpIMJwSXCsdx2BWGznXvUAvq1Y=; b=OwwRIQ+CS+R1Ll33ETd/X9DLlFUNBTiDj49ilAOtjfHozQLjy3eT8ebBaqMcfKwgUCwG HRcxLvyqQ/Z+qz/O2WHjJ8iPSb4TnLERxJXIgpwHw8NIFMzU7LmnIMgIVciltIYO0uSXo f/B51dOCtzH2Tc5WHNDT1p/eBoCroMiv7FokLavPOvq9DdniX8tgDD4kxxjJ8raYEGxLq batW1u5f3+g9zmE1vd0iZvCf4iqqJNaxPoFLYloJ1xGzkjwF9ICEhubF2SUbasqYe7hwD YtMiLF/A/EXNgQ2lcHgPDYrEHieZGn7vg2xnRP8eq4QIq/b1AL29LCl04F9gIF4TK7A== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=B59KN+ov; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 881F5606A324; Tue, 27 Oct 2026 01:42:15 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=B59KN+ov X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793065329; b=yNHsfDB5bXHxaGUzsZtKtHLpouqjmLWaXLfo17yZNsnKvATXAvqqicBSF8IJkdK2/Ro0 Rjsb16CKUYL7G68kJormejKZVpSzRpbYNvNuaUis7Sbjs1BsS/xcuVBzRO1aQdm0ta+Dm yYF5ThI/1632+GfPb+99Wi6CzbnRQs/1H3FovXrRjrjgEAZHHAZsi04gucuTJnDPSmZu2 qrmVnivP4tmMcO9q834F4nam5OtlFHPts4Q8SA0jNcwxiv4H0r+uLQ1LsRFkKdx/zGcwg wvzppFlc9NEnmJXWgp7Q/P9q9Rnrx8MUlYFYbOF93f0e06nvB/5KMuJOAX8TYJ6j5cg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793065329; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=9d/9KitAZXEBwhLTbhpIMJwSXCsdx2BWGznXvUAvq1Y=; b=jvJdNlJ1YAn2uC8rfwMNxvhRB9sCTBW8qBwEMU6HGS3nIgTXSNn5lf443fX/kqA5rTPJ LW4hzSDIZfD9urikAE1eiVuc9mERl2CWGJ6FRqhLedWbq/T++0Do/1FD+DAsRxyeqsjVl JnGQJV22ue2ly6zdNFGxZvNd9rdEc25fXs8Pqb07cl2jGmOZ3VqU1WJDQ1C9Ob9FvuLth rmos7iLZeqkMciIp7KKlOcN0Ifp7TbZpduc6y9OmLbKRsYoKr+XB50rmbXVhZ+DtcWnwA g7msj2wPTN1+Ovn4T8GcnjM3YRUhy+1tYTzwNJQg3S5I7+YPOW1gi7K11KUZtKul3bQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=B59KN+ov; arc=none smtp.remote-ip=100.103.45.18 X-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 68C10606A32D; Tue, 27 Oct 2026 01:42:09 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 005B81F01828; Tue, 27 Oct 2026 01:42:07 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793065329; bh=9d/9KitAZXEBwhLTbhpIMJwSXCsdx2BWGznXvUAvq1Y=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=B59KN+ovxuBuaYX4aqCHx6CfdlejeF5RHsrqLZDvEnDNrfRFqFSV/bSW3HOa5Itbk 6JXU1tWz8GadX4g1dADO/6v4fRgfNgRIVSrbkxcq4Zhxz/TRwoDDuKJXhPENvKSjhT ROFIXKQaM8rgwvCe/4bhBNNqcKbCXIRBw8+USgXKvHicg7/Wn7qtagyaVJhK61IUMn Ip6PFqbARNtTSFyeksfZZGKqLBu1K8/B1jkNPYfm39jYxbUfqdWy6TivV70vTTb3f8 0DrtHM3mE/M8SAI64Kt4H0WZOKQ61wFFVRTbWxobDxRDGciBUFLdg0+l0hgT5lg8T0 Uqi/SbKUQpWoA== X-Cc: netdev@vger.kernel.org, joshwash@google.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, jordanrhee@google.com, willemb@google.com, przemyslaw.kitszel@intel.com, nktgrg@google.com, maolson@google.com, jacob.e.keller@intel.com, pkaligineedi@google.com, yangchun@google.com, patricion@google.com, awogbemila@google.com, stable@vger.kernel.org, linux-kernel@vger.kernel.org, treapking@google.com X-In-Reply-To: <20261023204706.3112215-4-hramamurthy@google.com> X-sashiko-severity: Low X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list