CVE-2024-42148: bnx2x: Fix multiple UBSAN array-index-out-of-bounds

Published Jul 30, 2024
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

bnx2x: Fix multiple UBSAN array-index-out-of-bounds

Fix UBSAN warnings that occur when using a system with 32 physical cpu cores or more, or when the user defines a number of Ethernet queues greater than or equal to FPSBMAXE1x using the numqueues module parameter.

Currently there is a read/write out of bounds that occurs on the array "struct statsqueryentry query" present inside the "bnx2xfwstatsreq" struct in "drivers/net/ethernet/broadcom/bnx2x/bnx2x.h". Looking at the definition of the "struct statsqueryentry query" array:

struct statsqueryentry query[FPSBMAXE1x+ BNX2XFIRSTQUEUEQUERYIDX];

FPSBMAXE1x is defined as the maximum number of fast path interrupts and has a value of 16, while BNX2XFIRSTQUEUEQUERYIDX has a value of 3 meaning the array has a total size of 19. Since accesses to "struct statsqueryentry query" are offset-ted by BNX2XFIRSTQUEUEQUERYIDX, that means that the total number of Ethernet queues should not exceed FPSBMAXE1x (16). However one of these queues is reserved for FCOE and thus the number of Ethernet queues should be set to [FPSBMAXE1x -1] (15) if FCOE is enabled or [FPSBMAXE1x] (16) if it is not.

This is also described in a comment in the source code in drivers/net/ethernet/broadcom/bnx2x/bnx2x.h just above the Macro definition of FPSBMAXE1x. Below is the part of this explanation that it important for this patch

/ The total number of L2 queues, MSIX vectors and HW contexts (CIDs) is control by the number of fast-path status blocks supported by the device (HW/FW). Each fast-path status block (FP-SB) aka non-default status block represents an independent interrupts context that can serve a regular L2 networking queue. However special L2 queues such as the FCoE queue do not require a FP-SB and other components like the CNIC may consume FP-SB reducing the number of possible L2 queues If the maximum number of FP-SB available is X then: a. If CNIC is supported it consumes 1 FP-SB thus the max number of regular L2 queues is Y=X-1 b. In MF mode the actual number of L2 queues is Y= (X-1/MFfactor) c. If the FCoE L2 queue is supported the actual number of L2 queues is Y+1 d. The number of irqs (MSIX vectors) is either Y+1 (one extra for slow-path interrupts) or Y+2 if CNIC is supported (one additional FP interrupt context for the CNIC). e. The number of HW context (CID count) is always X or X+1 if FCoE L2 queue is supported. The cid for the FCoE L2 queue is always X. /

However this driver also supports NICs that use the E2 controller which can handle more queues due to having more FP-SB represented by FPSBMAXE2. Looking at the commits when the E2 support was added, it was originally using the E1x parameters: commit f2e0899f0f27 ("bnx2x: Add 57712 support"). Back then FPSBMAXE2 was set to 16 the same as E1x. However the driver was later updated to take full advantage of the E2 instead of having it be limited to the capabilities of the E1x. But as far as we can tell, the array "statsqueryentry query" was still limited to using the FP-SB available to the E1x cards as part of an oversignt when the driver was updated to take full advantage of the E2, and now with the driver being aware of the greater queue size supported by E2 NICs, it causes the UBSAN warnings seen in the stack traces below.

This patch increases the size of the "statsqueryentry query" array by replacing FPSBMAXE1x with FPSBMAXE2 to be large enough to handle both types of NICs.

Stack traces:

UBSAN: array-index-out-of-bounds in drivers/net/ethernet/broadcom/bnx2x/bnx2xstats.c:1529:11 index 20 is out of range for type 'statsqueryentry [19]' CPU: 12 PID: 858 Comm: systemd-network Not tainted 6.9.0-060900rc7-generic #202405052133 Hardware name: HP ProLiant DL360 Gen9/ProLiant DL360 ---truncated---

Affected Software

9 affected componentsFixes available
Linux Linux kernel>=3.3<4.19.318
Linux Linux kernel>=4.20<5.4.280
Linux Linux kernel>=5.5<5.10.222
Linux Linux kernel>=5.11<5.15.163
Linux Linux kernel>=5.16<6.1.98
Linux Linux kernel>=6.2<6.6.39
Linux Linux kernel>=6.7<6.9.9
debian/linux
5.10.223-15.10.234-16.1.129-16.1.135-16.12.25-16.12.27-1
debian/linux-6.1
6.1.129-1~deb11u1

Event History

Jul 30, 2024
CVE Published
via MITRE·07:46 AM
Data Sourced
via MITRE·07:46 AM
Description
Data Sourced
via NVD·08:15 AM
RemedyDescriptionSeverityWeaknessAffected Software
May 1, 2025
Data Sourced
via Ubuntu·06:17 PM
RemedyDescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2024-42148?

CVE-2024-42148 is classified as a medium severity vulnerability.

2

How do I fix CVE-2024-42148?

To fix CVE-2024-42148, update the Linux kernel to the patched versions such as 5.10.223-1 or 6.1.123-1.

3

Which versions of the Linux kernel are affected by CVE-2024-42148?

CVE-2024-42148 affects Linux kernel versions from 3.3 to 6.6.39.

4

What type of vulnerability is CVE-2024-42148?

CVE-2024-42148 is an array index out-of-bounds vulnerability in the bnx2x driver.

5

Is CVE-2024-42148 specific to any particular Linux distributions?

CVE-2024-42148 is relevant to various distributions using the affected Linux kernel versions.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203