From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1974606A322 for ; Thu, 3 Dec 2026 23:27:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=gKk4yleq Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1799940A6D; Fri, 4 Dec 2026 00:26:49 +0100 (CET) Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) by mails.dpdk.org (Postfix) with ESMTPS id 31E3D40276 for ; Fri, 4 Dec 2026 00:26:48 +0100 (CET) Received: by mail-ot1-f71.google.com with SMTP id 46e09a7af769-862ad1e3959so295100a34.2 for ; Thu, 03 Dec 2026 15:26:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796340407; x=1796945207; darn=dpdk.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=6GkBRh4lymxxVp9RI8Yw6Z41ralHul/5NKBfyHS/8gU=; b=gKk4yleq9wlaKQdh02QlwSR6WFPI2MA/Uytp0ufsAG4s3LZEvYX2amhe2xswql/+4x XWd/qurz7hUkd0fP5pQoKh/HVdZkpsiQjgszxt5JMRWPrMfg77YDTtS4+1G2Y90ZyG4G cmParOXAwgE8cE/XNgTm3a1M4Obh1eJtkUmMc1imn1veeBkRZOY0EXx9QAYH0ZwDR7P+ yo0Nm5RZjycvQSz4Uqg1FltslED9vZAe4O6Y+F6oDQ3lKdYFyY01KZXNm1dxqJ9mBi6d 9suAPjl+DVpVLrHS8eChnBz4cXQDtldnc+qH+b61x1vxLVZHtEEB5fnmRKijO3sw8UAQ VDpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796340407; x=1796945207; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=6GkBRh4lymxxVp9RI8Yw6Z41ralHul/5NKBfyHS/8gU=; b=gtCuNH4kpVC33oq65+mdBFyz/exCfvMUxCPKZEjUPnw/w0m77L/gaVbR3nZLgoPWaA jJfqrl+OQ9REutqVGxTDdARgqVdku1JxVrC0VjzNPSCJkDLtpeVX5OtZUFaU9EawJgT3 kusSs+U70JjDMKhuZjmloEPh5IoQR0+0APVORF91ZGkEbnCB5+raLDsKarTeng04LleH ngheiMZcYKKkqWr61zNT8lnTWRn3j9LPvoFuy+NkrHl/Bt4yZstHdhHgKw2kY7bbOTyu 6k2MFMnB53r4UlLXMYh0/w4jZv2KGS13KqP1ZN5jtyWDxhxAa56thqsuqeNAE4e9Rbfb Wy5g== X-Gm-Message-State: APuU4Z9v7aCf8Om87xvVATFlpR056d9vosc3X5pluxM2nCCYxK9l+A6B BNjLLfm7FarBAkqxITg6ooyHrhoJ9B3d54WbdDKaav527IIb9MMBDsVSx8RkX+p9jwcyR/KrS5+ 6Hkt+Eg1fEbVCBA== X-Received: from ilej11-n1.prod.google.com ([2002:a05:6e02:620b:10b0:53c:4ee7:975a]) (user=joshwash job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6820:81e:b0:71b:7e60:c346 with SMTP id 006d021491bc7-71bf22c8332mr174836eaf.70.1796340406718; Thu, 03 Dec 2026 15:26:46 -0800 (PST) Date: Thu, 3 Dec 2026 15:26:26 -0800 In-Reply-To: <20261203232637.1044501-1-joshwash@google.com> X-Archived-By: Mime-Version: 1.0 References: <20261203232637.1044501-1-joshwash@google.com> X-Mailer: git-send-email 2.56.1.915.g69d5ec7298-goog Message-ID: <20261203232637.1044501-4-joshwash@google.com> Subject: [PATCH 03/12] net/gve: fix integer underflow in GQI Rx path From: Joshua Washington To: Joshua Washington , Junfeng Guo , Xiaoyun Li Cc: dev@dpdk.org, stable@dpdk.org, "Jasper Tran O'Leary" Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 In gve_rx(), GVE_RX_PAD is unconditionally subtracted from frag_size on the first fragment of a packet without verifying that frag_size is at least GVE_RX_PAD. If the descriptor reports a length smaller than GVE_RX_PAD, the uint16_t subtraction underflows, causing an out-of-bounds copy in gve_rx_mbuf() when operating in QPL mode. Check that frag_size >= GVE_RX_PAD on the first fragment before subtracting. If it is smaller, log an error, mark the packet to be dropped, increment rxq->stats.errors, and jump to drop_frag. Fixes: a46583cf43c8 ("net/gve: support Rx/Tx") Cc: stable@dpdk.org Signed-off-by: Joshua Washington Reviewed-by: Jasper Tran O'Leary --- drivers/net/gve/gve_rx.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/gve/gve_rx.c b/drivers/net/gve/gve_rx.c index 8e7557e774..1985e9ad02 100644 --- a/drivers/net/gve/gve_rx.c +++ b/drivers/net/gve/gve_rx.c @@ -156,8 +156,16 @@ gve_rx(struct gve_rx_queue *rxq, volatile struct gve_rx_desc *rxd, uint16_t rx_i goto drop_frag; } - if (is_first_frag) + if (is_first_frag) { + if (unlikely(frag_size < GVE_RX_PAD)) { + PMD_DRV_DP_LOG(ERR, "Rx fragment size (%u) smaller than padding (%u)", + frag_size, GVE_RX_PAD); + ctx->drop_pkt = true; + rxq->stats.errors++; + goto drop_frag; + } frag_size -= GVE_RX_PAD; + } rxe = rxq->sw_ring[rx_id]; gve_rx_mbuf(rxq, rxe, frag_size, rx_id); -- 2.56.1.915.g69d5ec7298-goog