Received: from mail-yw1-f227.google.com (mail-yw1-f227.google.com [209.85.128.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 895413B7A8 for ; Thu, 9 Jul 2026 20:09:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.227 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783627742; cv=none; b=JEAS9KeOr5yyPmNJtQO2q9Zi/dZyDdCtYLSazpSYeIBGTzWHx/RjrhKaNI2nbFbRxLzwklAyWfn705BIdT3mS0W4HKWj2lqG3SJcrFUgyfXqbP2m4LulBJNC4GXdeMn4M9U4MTuqe6VW+qVFH89mUfqx8QvILQctnZwvESbfKOs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783627742; c=relaxed/simple; bh=Rtt8nr3qT6hzMGJBoDeZojgqNi/SCvnpBDlzHvuaz5E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oTdRtB5qaug14hUDOJMVPdWiyUJXHzK975eJ4920arytFN7ZK4E3s8TXuJtLJcHaVfidw8sJFPM+7OOvkXik4llSb60AByii5GwmtMjR8OFy4k/AzBBb1WQbKY2BvXYnBoyKEGHKEYJDymaUydzzerzlYd/JEtkQifIWKdWMffk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=d21jD8Nk; arc=none smtp.client-ip=209.85.128.227 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="d21jD8Nk" Received: by mail-yw1-f227.google.com with SMTP id 00721157ae682-80cebd41372so2753907b3.3 for ; Thu, 09 Jul 2026 13:09:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783627739; x=1784232539; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=+lEIT10jaUsYVAQviHGdUkscS5sAHeOl4kQGTRtqCbo=; b=IAqY18zk3+usRjomzDODneDWDjqIq4kT++IplLCD0x8V5YAjbwl7B1kTm4o7vW7ARp 60ArmHU0oNu+FWAdlcbuKwbtGkm3bj35edgWPfenvjQWt31Jk7VPLbB3LGF3vtOHEhN0 tUjpAJnrdemcB9/lcs/VgluMd56QGK6fOfNR6C5SObgibtuS/dJlQaRxbUHIw+Mz83Mr fOiX0B9R2nMPerBt44z7d6DwTPMfeKRxbwQGJjrMbBrfvJTI4wESFDtTMAmCThygc0Uq ks6bTQO0A0smDvIcUwqjd3Dh52yn8w6KomMq9cLg1UsbGvlj/ausNU/weogk6M3Rxf+E istg== X-Forwarded-Encrypted: i=1; AHgh+RoCLRQW6J8BgonFrvxAy6llRz7oZwIbm1d4r+EoMeaVuoGzlQRMgGur6uQeMlnXZnEAMbXgqej5aPKvCTk=@vger.kernel.org X-Gm-Message-State: AOJu0Yy6rkO0/v6t3Cmo9vof9nNk0ldiPjZn5xgl2aZZrREnjYdlyZqw tDENKsa/DPsEj1ZGAIou+jsmuyb43EEpEr4CBZ3ytlwhweQTEzw13R3kQWN0qT2OC8MCDyr2QCg Arwm2V628JQFALZ8L+6lxq8o47Ya4L1jTQRms9w9XErFmxzGAUnQlpQFTW7yKcgLP0mYxtbKTvl ybvyV4G2g3EgLj6gn6UDTKG3DX9bKuv+G1oQO6zRovexvXDKmd8+4BlIqeanFdYZ1s0rFu9VmV1 4u5A3tuh0Pv1eGkx0IH1chPAd/u X-Gm-Gg: AfdE7clk/pgshQYy8oc8dnXiT7O+cTDpAZYHw0T/2qCw2wHiIBxBiqZffxQa1kqf14Q qzPx8ZbgZD0L3ecBUTS6GvaT1DcEWlumebOe7aof1OS63tSwz2iZSMpFsSXoLbHR1w/kuy3YE2P fimIg5IKKxUo4xBC6oby0wRXy3yFDzSYEU4F7hkGhbfzAynPEM2HefKiTXDrMzn0CoP8xP83SDl lDZmO35PgjhSnE9nsHYQzYEp5L5hsWvFLQVFHT4FwRS8XdxmzS1o8JQYgfFbtzY8VKKBk9vbFsm WIcxV1GlTobmU2ojBSmah3Qopq8Pt9NXTgJXMbxHqKHnDrRJHMkQGYUA6YQOLzBcgagrpj57QtG o8NYf0Tz1pnt8AF8akMCtMU0ILdi56dj/Xb9orNeFMxvXUYSIb427570WLH4O/fR6PtTJ2IQ2/y jdPo+SGWstuV5KsNodOPmkpQNldAe6AjUtWdVI4UTVZrhT6At7PWSg X-Received: by 2002:a05:690c:250a:b0:81e:6a1d:d9e with SMTP id 00721157ae682-81e6a1d3a20mr41718037b3.21.1783627739169; Thu, 09 Jul 2026 13:08:59 -0700 (PDT) Received: from smtp-us-east1-p01-i01-si01.dlp.protect.broadcom.com (address-144-49-247-11.dlp.protect.broadcom.com. [144.49.247.11]) by smtp-relay.gmail.com with ESMTPS id 00721157ae682-81e6be80ad8sm1742387b3.1.2026.07.09.13.08.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jul 2026 13:08:59 -0700 (PDT) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-84857446424so259579b3a.1 for ; Thu, 09 Jul 2026 13:08:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1783627738; x=1784232538; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=+lEIT10jaUsYVAQviHGdUkscS5sAHeOl4kQGTRtqCbo=; b=d21jD8NkPYyoHp9FTM4GFyhlCyxpO7KV8g7bmgJh1z5LaD6YMjBCwu5mwKnqBk2oj+ 97zRGL0fssrq+6JYHmQmlNi72BFBbrEkuEn8LQ7v2jYlgz9XWu2rlP0X5sqHgGRvZsCW XBRbSKHNrTCShmxgNM4/El1zcqyAnJfnfjA58= X-Forwarded-Encrypted: i=1; AHgh+RqIZywqMcKmIuiZhK93fwp+URn7RUOhKQiWwtnpz9L8xnPIzKgoK4cxclmp6fJyGfqUdayhQYRsSp6SQa8=@vger.kernel.org X-Received: by 2002:a05:6300:141:b0:3bf:a38b:e8ca with SMTP id adf61e73a8af0-3c0bd3118e9mr10086202637.59.1783627737914; Thu, 09 Jul 2026 13:08:57 -0700 (PDT) X-Received: by 2002:a05:6300:141:b0:3bf:a38b:e8ca with SMTP id adf61e73a8af0-3c0bd3118e9mr10086183637.59.1783627737460; Thu, 09 Jul 2026 13:08:57 -0700 (PDT) Received: from lvn-dbc2448.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13b65960d88sm28947940c88.6.2026.07.09.13.08.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2026 13:08:56 -0700 (PDT) From: Harshaka Narayana To: harshaka.narayana@broadcom.com Cc: andrew+netdev@lunn.ch, bcm-kernel-feedback-list@broadcom.com, davem@davemloft.net, edumazet@google.com, guolin.yang@broadcom.com, kuba@kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, ronak.doshi@broadcom.com, sankararaman.jayaraman@broadcom.com Subject: [PATCH net v2] vmxnet3: fix BUG_ON in vmxnet3_get_hdr_len() for Geneve packets Date: Thu, 9 Jul 2026 12:47:03 -0700 Message-ID: <20260709194703.3678075-1-harshaka.narayana@broadcom.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260707165248.1859188-1-harshaka.narayana@broadcom.com> References: <20260707165248.1859188-1-harshaka.narayana@broadcom.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DetectorID-Processed: b00c1d49-9d2e-4205-b15f-d015386d3d5e vmxnet3_get_hdr_len() assumes gdesc->rcd.v4/v6/tcp always describe the outer header, but for a Geneve-encapsulated packet the device can set them based on the inner header instead, signalled by the VMXNET3_RCD_HDR_INNER_SHIFT bit in the completion descriptor. Since the function never skips the outer encapsulation, this mismatch triggers: - BUG_ON(hdr.ipv4->protocol != IPPROTO_TCP), because the outer protocol is UDP (Geneve), not TCP. - BUG_ON(hdr.eth->h_proto != ...), when the tunnel's outer and inner IP versions differ (e.g. outer IPv6/inner IPv4 or vice versa). Check VMXNET3_RCD_HDR_INNER_SHIFT up front and bail out, since the function cannot locate the inner header it would need to parse. Also convert the remaining BUG_ON()s in this function to return 0 defensively. Fixes: 45dac1d6ea04 ("vmxnet3: Changes for vmxnet3 adapter version 2 (fwd)") Signed-off-by: Harshaka Narayana Signed-off-by: Ronak Doshi Signed-off-by: Sankararaman Jayaraman --- v2: - Check VMXNET3_RCD_HDR_INNER_SHIFT up front to catch the Geneve inner-header case directly, and convert the remaining BUG_ON(hdr.eth->h_proto != ...) checks to return 0 - Reworded commit message to describe the root cause via VMXNET3_RCD_HDR_INNER_SHIFT v1: https://lore.kernel.org/netdev/20260707165248.1859188-1-harshaka.narayana@broadcom.com/ --- drivers/net/vmxnet3/vmxnet3_drv.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 40522afc0532..dedf4082eb6c 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c @@ -1530,7 +1530,13 @@ vmxnet3_get_hdr_len(struct vmxnet3_adapter *adapter, struct sk_buff *skb, struct ipv6hdr *ipv6; struct tcphdr *tcp; } hdr; - BUG_ON(gdesc->rcd.tcp == 0); + + /* v4/v6/tcp then describe the inner header, which we can't locate. */ + if (le32_to_cpu(gdesc->dword[0]) & (1UL << VMXNET3_RCD_HDR_INNER_SHIFT)) + return 0; + + if (gdesc->rcd.tcp == 0) + return 0; maplen = skb_headlen(skb); if (unlikely(sizeof(struct iphdr) + sizeof(struct tcphdr) > maplen)) @@ -1544,15 +1550,21 @@ vmxnet3_get_hdr_len(struct vmxnet3_adapter *adapter, struct sk_buff *skb, hdr.eth = eth_hdr(skb); if (gdesc->rcd.v4) { - BUG_ON(hdr.eth->h_proto != htons(ETH_P_IP) && - hdr.veth->h_vlan_encapsulated_proto != htons(ETH_P_IP)); + if (hdr.eth->h_proto != htons(ETH_P_IP) && + hdr.veth->h_vlan_encapsulated_proto != htons(ETH_P_IP)) + return 0; + hdr.ptr += hlen; - BUG_ON(hdr.ipv4->protocol != IPPROTO_TCP); + if (hdr.ipv4->protocol != IPPROTO_TCP) + return 0; + hlen = hdr.ipv4->ihl << 2; hdr.ptr += hdr.ipv4->ihl << 2; } else if (gdesc->rcd.v6) { - BUG_ON(hdr.eth->h_proto != htons(ETH_P_IPV6) && - hdr.veth->h_vlan_encapsulated_proto != htons(ETH_P_IPV6)); + if (hdr.eth->h_proto != htons(ETH_P_IPV6) && + hdr.veth->h_vlan_encapsulated_proto != htons(ETH_P_IPV6)) + return 0; + hdr.ptr += hlen; /* Use an estimated value, since we also need to handle * TSO case. -- 2.52.0