Skip to content
OpenAdvisories
Medium · 4.4 CVE-2024-38540 EUVD-2024-37403GHSA-h5r4-f5wx-726x

bnxt_re: avoid shift undefined behavior in bnxt_qplib_alloc_init_hwq

Published Jun 19, 2024 · Updated May 11, 2026 · Assigned by Linux

Vendor: Linux Product: Linux Package: kernel Package: linux Package: linux Package: linux-allwinner-5.19 Package: linux-aws Package: linux-aws-5.0 Package: linux-aws-5.11 Package: linux-aws-5.13 Package: linux-aws-5.15 Package: linux-aws-5.19 Package: linux-aws-5.3 Package: linux-aws-5.8 Package: linux-aws-6.2 Package: linux-aws-6.5 Package: linux-aws-6.8 Package: linux-aws-fips Package: linux-azure Package: linux-azure-5.11 Package: linux-azure-5.13 Package: linux-azure-5.15 Package: linux-azure-5.19 Package: linux-azure-5.3 Package: linux-azure-5.8 Package: linux-azure-6.2 Package: linux-azure-6.5 Package: linux-azure-6.8 Package: linux-azure-edge Package: linux-azure-fde Package: linux-azure-fde-5.19 Package: linux-azure-fde-6.2 Package: linux-azure-fips Package: linux-bluefield Package: linux-fips Package: linux-gcp Package: linux-gcp-5.11 Package: linux-gcp-5.13 Package: linux-gcp-5.15 Package: linux-gcp-5.19 Package: linux-gcp-5.3 Package: linux-gcp-5.8 Package: linux-gcp-6.2 Package: linux-gcp-6.5 Package: linux-gcp-6.8 Package: linux-gcp-fips Package: linux-gke Package: linux-gke-4.15 Package: linux-gke-5.15 Package: linux-gke-5.4 Package: linux-gkeop Package: linux-gkeop-5.15 Package: linux-gkeop-5.4 Package: linux-hwe Package: linux-hwe-5.11 Package: linux-hwe-5.13 Package: linux-hwe-5.15 Package: linux-hwe-5.19 Package: linux-hwe-5.8 Package: linux-hwe-6.2 Package: linux-hwe-6.5 Package: linux-hwe-6.8 Package: linux-hwe-edge Package: linux-ibm Package: linux-ibm-5.15 Package: linux-ibm-6.8 Package: linux-intel-5.13 Package: linux-intel-iot-realtime Package: linux-intel-iotg Package: linux-intel-iotg-5.15 Package: linux-kvm Package: linux-lowlatency Package: linux-lowlatency-hwe-5.15 Package: linux-lowlatency-hwe-5.19 Package: linux-lowlatency-hwe-6.2 Package: linux-lowlatency-hwe-6.5 Package: linux-lowlatency-hwe-6.8 Package: linux-nvidia Package: linux-nvidia-6.2 Package: linux-nvidia-6.5 Package: linux-nvidia-6.8 Package: linux-nvidia-lowlatency Package: linux-nvidia-tegra Package: linux-nvidia-tegra-5.15 Package: linux-nvidia-tegra-igx Package: linux-oem Package: linux-oem-5.10 Package: linux-oem-5.13 Package: linux-oem-5.14 Package: linux-oem-5.17 Package: linux-oem-5.6 Package: linux-oem-6.0 Package: linux-oem-6.1 Package: linux-oem-6.5 Package: linux-oem-6.8 Package: linux-oracle Package: linux-oracle-5.0 Package: linux-oracle-5.11 Package: linux-oracle-5.13 Package: linux-oracle-5.15 Package: linux-oracle-5.3 Package: linux-oracle-5.8 Package: linux-oracle-6.5 Package: linux-oracle-6.8 Package: linux-raspi Package: linux-raspi-realtime Package: linux-raspi2 Package: linux-realtime Package: linux-realtime-6.8 Package: linux-riscv Package: linux-riscv-5.11 Package: linux-riscv-5.15 Package: linux-riscv-5.19 Package: linux-riscv-5.8 Package: linux-riscv-6.5 Package: linux-riscv-6.8 Package: linux-starfive-5.19 Package: linux-starfive-6.2 Package: linux-starfive-6.5 Package: linux-vmware Package: linux-xilinx-zynqmp Platform: Linux Ecosystem: Azure Linux Ecosystem: Debian Ecosystem: Ubuntu

Description

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

bnxt_re: avoid shift undefined behavior in bnxt_qplib_alloc_init_hwq

Undefined behavior is triggered when bnxt_qplib_alloc_init_hwq is called
with hwq_attr->aux_depth != 0 and hwq_attr->aux_stride == 0.
In that case, "roundup_pow_of_two(hwq_attr->aux_stride)" gets called.
roundup_pow_of_two is documented as undefined for 0.

Fix it in the one caller that had this combination.

The undefined behavior was detected by UBSAN:
UBSAN: shift-out-of-bounds in ./include/linux/log2.h:57:13
shift exponent 64 is too large for 64-bit type 'long unsigned int'
CPU: 24 PID: 1075 Comm: (udev-worker) Not tainted 6.9.0-rc6+ #4
Hardware name: Abacus electric, s.r.o. - servis@abacus.cz Super Server/H12SSW-iN, BIOS 2.7 10/25/2023
Call Trace:
<TASK>
dump_stack_lvl+0x5d/0x80
ubsan_epilogue+0x5/0x30
__ubsan_handle_shift_out_of_bounds.cold+0x61/0xec
__roundup_pow_of_two+0x25/0x35 [bnxt_re]
bnxt_qplib_alloc_init_hwq+0xa1/0x470 [bnxt_re]
bnxt_qplib_create_qp+0x19e/0x840 [bnxt_re]
bnxt_re_create_qp+0x9b1/0xcd0 [bnxt_re]
? srso_alias_return_thunk+0x5/0xfbef5
? srso_alias_return_thunk+0x5/0xfbef5
? __kmalloc+0x1b6/0x4f0
? create_qp.part.0+0x128/0x1c0 [ib_core]
? __pfx_bnxt_re_create_qp+0x10/0x10 [bnxt_re]
create_qp.part.0+0x128/0x1c0 [ib_core]
ib_create_qp_kernel+0x50/0xd0 [ib_core]
create_mad_qp+0x8e/0xe0 [ib_core]
? __pfx_qp_event_handler+0x10/0x10 [ib_core]
ib_mad_init_device+0x2be/0x680 [ib_core]
add_client_context+0x10d/0x1a0 [ib_core]
enable_device_and_get+0xe0/0x1d0 [ib_core]
ib_register_device+0x53c/0x630 [ib_core]
? srso_alias_return_thunk+0x5/0xfbef5
bnxt_re_probe+0xbd8/0xe50 [bnxt_re]
? __pfx_bnxt_re_probe+0x10/0x10 [bnxt_re]
auxiliary_bus_probe+0x49/0x80
? driver_sysfs_add+0x57/0xc0
really_probe+0xde/0x340
? pm_runtime_barrier+0x54/0x90
? __pfx___driver_attach+0x10/0x10
__driver_probe_device+0x78/0x110
driver_probe_device+0x1f/0xa0
__driver_attach+0xba/0x1c0
bus_for_each_dev+0x8f/0xe0
bus_add_driver+0x146/0x220
driver_register+0x72/0xd0
__auxiliary_driver_register+0x6e/0xd0
? __pfx_bnxt_re_mod_init+0x10/0x10 [bnxt_re]
bnxt_re_mod_init+0x3e/0xff0 [bnxt_re]
? __pfx_bnxt_re_mod_init+0x10/0x10 [bnxt_re]
do_one_initcall+0x5b/0x310
do_init_module+0x90/0x250
init_module_from_file+0x86/0xc0
idempotent_init_module+0x121/0x2b0
__x64_sys_finit_module+0x5e/0xb0
do_syscall_64+0x82/0x160
? srso_alias_return_thunk+0x5/0xfbef5
? syscall_exit_to_user_mode_prepare+0x149/0x170
? srso_alias_return_thunk+0x5/0xfbef5
? syscall_exit_to_user_mode+0x75/0x230
? srso_alias_return_thunk+0x5/0xfbef5
? do_syscall_64+0x8e/0x160
? srso_alias_return_thunk+0x5/0xfbef5
? __count_memcg_events+0x69/0x100
? srso_alias_return_thunk+0x5/0xfbef5
? count_memcg_events.constprop.0+0x1a/0x30
? srso_alias_return_thunk+0x5/0xfbef5
? handle_mm_fault+0x1f0/0x300
? srso_alias_return_thunk+0x5/0xfbef5
? do_user_addr_fault+0x34e/0x640
? srso_alias_return_thunk+0x5/0xfbef5
? srso_alias_return_thunk+0x5/0xfbef5
entry_SYSCALL_64_after_hwframe+0x76/0x7e
RIP: 0033:0x7f4e5132821d
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e3 db 0c 00 f7 d8 64 89 01 48
RSP: 002b:00007ffca9c906a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
RAX: ffffffffffffffda RBX: 0000563ec8a8f130 RCX: 00007f4e5132821d
RDX: 0000000000000000 RSI: 00007f4e518fa07d RDI: 000000000000003b
RBP: 00007ffca9c90760 R08: 00007f4e513f6b20 R09: 00007ffca9c906f0
R10: 0000563ec8a8faa0 R11: 0000000000000246 R12: 00007f4e518fa07d
R13: 0000000000020000 R14: 0000563ec8409e90 R15: 0000563ec8a8fa60
</TASK>
---[ end trace ]---

Affected products

VendorProductAffectedFixed
Linux Linux 5.7 5.15.181

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 linux 6.8.12-1 —
Debian 13 linux 6.8.12-1 —
Debian 12 linux 6.1.119-1 DSA-5818-1
Debian 11 linux-6.1 6.1.119-1~deb11u1 DLA-4008-1
ReleasePackageFixed inAdvisory
Ubuntu Nvidia-BlueField 22.04 LTS linux-bluefield 5.15.0-1072.74 —
Ubuntu 24.04 LTS linux 6.8.0-40.40 USN-6949-1
Ubuntu 24.04 LTS linux-aws 6.8.0-1013.14 USN-6949-1
Ubuntu 24.04 LTS linux-azure 6.8.0-1012.14 USN-6952-2
Ubuntu 24.04 LTS linux-gcp 6.8.0-1012.13 USN-6949-1
Ubuntu 24.04 LTS linux-gke 6.8.0-1008.11 USN-6949-1
Ubuntu 24.04 LTS linux-ibm +2 6.8.0-1010.10 USN-6955-1, USN-6952-1, USN-6949-1
Ubuntu 24.04 LTS linux-nvidia 6.8.0-1011.11 USN-6949-1
Ubuntu 24.04 LTS linux-nvidia-lowlatency 6.8.0-1011.11.1 USN-6952-1
Ubuntu 24.04 LTS linux-raspi 6.8.0-1009.10 USN-6949-2
Ubuntu 24.04 LTS linux-riscv +1 6.8.0-40.40.1 USN-6949-2
Ubuntu 22.04 LTS linux +1 5.15.0-144.157 USN-7654-1
Ubuntu 22.04 LTS linux-aws 5.15.0-1088.95 USN-7654-1
Ubuntu 22.04 LTS linux-aws-6.8 6.8.0-1013.14~22.04.1 —
Ubuntu 22.04 LTS linux-azure 5.15.0-1094.103 USN-7711-1
Ubuntu 22.04 LTS linux-azure-6.8 6.8.0-1012.14~22.04.1 —
Ubuntu 22.04 LTS linux-azure-fde 5.15.0-1094.103.1 —
Ubuntu 22.04 LTS linux-gcp 5.15.0-1087.96 USN-7654-1
Ubuntu 22.04 LTS linux-gcp-6.8 6.8.0-1012.13~22.04.1 —
Ubuntu 22.04 LTS linux-gke +1 5.15.0-1085.91 USN-7654-1
Ubuntu 22.04 LTS linux-gkeop 5.15.0-1070.78 USN-7654-1
Ubuntu 22.04 LTS linux-hwe-6.8 6.8.0-40.40~22.04.3 —
Ubuntu 22.04 LTS linux-ibm 5.15.0-1080.83 USN-7654-1
Ubuntu 22.04 LTS linux-ibm-6.8 +1 6.8.0-1010.10~22.04.1 —
Ubuntu 22.04 LTS linux-intel-iotg 5.15.0-1083.89 USN-7654-1
Ubuntu 22.04 LTS linux-kvm 5.15.0-1084.89 USN-7654-4
Ubuntu 22.04 LTS linux-nvidia 5.15.0-1082.83 USN-7654-1
Ubuntu 22.04 LTS linux-nvidia-6.8 6.8.0-1011.11~22.04.1 USN-6949-1
Ubuntu 22.04 LTS linux-nvidia-tegra 5.15.0-1041.41 USN-7654-1
Ubuntu 22.04 LTS linux-nvidia-tegra-igx 5.15.0-1030.30 USN-7654-1
Ubuntu 22.04 LTS linux-raspi 5.15.0-1083.86 USN-7686-1
Ubuntu 22.04 LTS linux-riscv +32 No fix yet —
Ubuntu 22.04 LTS linux-riscv-6.8 +1 6.8.0-40.40.1~22.04.1 —
Ubuntu 22.04 LTS linux-xilinx-zynqmp 5.15.0-1052.56 USN-7654-5
Ubuntu 20.04 LTS linux-gke +27 No fix yet —
Ubuntu 18.04 LTS linux-gcp +13 No fix yet —
Show 7 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu 16.04 LTS linux-hwe-edge No fix yet —
Ubuntu Pro Realtime 24.04 LTS linux-raspi-realtime 6.8.0-2008.8 —
Ubuntu Pro Realtime 24.04 LTS linux-realtime 6.8.1-1006.6 —
Ubuntu Pro Realtime 22.04 LTS linux-intel-iot-realtime 5.15.0-1081.83 USN-7654-2
Ubuntu Pro Realtime 22.04 LTS linux-realtime 5.15.0-1088.97 USN-7654-2
Ubuntu Pro Realtime 22.04 LTS linux-realtime-6.8 6.8.1-1006.6~22.04.1 —
Ubuntu Pro FIPS-updates 24.04 LTS linux-fips 6.8.0-78.78+fips1 —
Ubuntu Pro FIPS-updates 22.04 LTS linux-aws-fips 5.15.0-1088.95+fips1 USN-7654-3
Ubuntu Pro FIPS-updates 22.04 LTS linux-azure-fips 5.15.0-1094.103+fips1 USN-7712-1
Ubuntu Pro FIPS-updates 22.04 LTS linux-fips 5.15.0-144.157+fips1 USN-7654-3
Ubuntu Pro FIPS-updates 22.04 LTS linux-gcp-fips 5.15.0-1087.96+fips1 USN-7654-3
Ubuntu Pro FIPS-preview 22.04 LTS linux-fips +3 No fix yet —
Ubuntu Pro 20.04 LTS linux-aws-5.15 5.15.0-1088.95~20.04.1 USN-7654-1
Ubuntu Pro 20.04 LTS linux-azure-5.15 5.15.0-1094.103~20.04.1 USN-7712-2
Ubuntu Pro 20.04 LTS linux-gcp-5.15 5.15.0-1087.96~20.04.2 USN-7654-1
Ubuntu Pro 20.04 LTS linux-hwe-5.15 +1 5.15.0-144.157~20.04.1 USN-7654-1
Ubuntu Pro 20.04 LTS linux-ibm-5.15 5.15.0-1080.83~20.04.1 USN-7654-1
Ubuntu Pro 20.04 LTS linux-intel-iotg-5.15 5.15.0-1083.89~20.04.1 USN-7655-1
Ubuntu Pro 20.04 LTS linux-nvidia-tegra-5.15 5.15.0-1041.41~20.04.1 USN-7654-1
Ubuntu Pro 20.04 LTS linux-oracle-5.15 5.15.0-1085.91~20.04.3 USN-7654-1
Ubuntu Pro 20.04 LTS linux-riscv-5.15 5.15.0-1083.87~20.04.1 —
ReleasePackageFixed inAdvisory
RHEL 9 bpftool 7.3.0-427.33.1.el9_4 RHSA-2024:5928
RHEL 9 rv +64 5.14.0-427.33.1.el9_4 RHSA-2024:5928
RHEL 8 kernel-rt +12 4.18.0-553.27.1.rt7.368.el8_10 RHSA-2024:8870
RHEL 8 perf +26 4.18.0-553.27.1.el8_10 RHSA-2024:8856
Show 5 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
RHEL 9.2 EUS bpftool 7.0.0-284.82.1.el9_2 RHSA-2024:6267
RHEL 9.2 EUS kernel-rt +14 5.14.0-284.82.1.rt14.367.el9_2 RHSA-2024:6268
RHEL 9.2 EUS perf +47 5.14.0-284.82.1.el9_2 RHSA-2024:6267
RHEL 8.8 EUS perf +26 4.18.0-477.70.1.el8_8 RHSA-2024:6206
RHEL 8.6 TUS perf +16 4.18.0-372.121.1.el8_6 RHSA-2024:6297
RHEL 8.6 E4S perf +24 4.18.0-372.121.1.el8_6 RHSA-2024:6297
RHEL 8.6 AUS perf +16 4.18.0-372.121.1.el8_6 RHSA-2024:6297

AlmaLinux

Errata ↗
ReleasePackageFixed inAdvisory
AlmaLinux 9 bpftool 7.3.0-427.33.1.el9_4 ALSA-2024:5928
AlmaLinux 9 rv +60 5.14.0-427.33.1.el9_4 ALSA-2024:5928
AlmaLinux 8 kernel-rt +9 4.18.0-553.27.1.rt7.368.el8_10 ALSA-2024:8870
AlmaLinux 8 perf +24 4.18.0-553.27.1.el8_10 ALSA-2024:8856

Rocky Linux

Errata ↗
ReleasePackageFixed inAdvisory
Rocky Linux 8 kernel 4.18.0-553.27.1.el8_10 RLSA-2024:8856
Rocky Linux 8 kernel-rt 4.18.0-553.27.1.rt7.368.el8_10 RLSA-2024:8870
ReleasePackageFixed inAdvisory
SLES 15 SP6 kernel-64kb 6.4.0-150600.23.14.1 SUSE-SU-2024:2571-1
SLES 15 SP6 kernel-azure +1 6.4.0-150600.8.8.2 SUSE-SU-2024:2896-1
SLES 15 SP6 kernel-default-base 6.4.0-150600.23.14.2.150600.12.4.3 SUSE-SU-2024:2571-1
SLES 15 SP6 kernel-docs +5 6.4.0-150600.23.14.2 SUSE-SU-2024:2571-1
SLES 15 SP6 kernel-syms-azure 6.4.0-150600.8.8.1 SUSE-SU-2024:2896-1
SLES 15 SP5 kernel-64kb +5 5.14.21-150500.55.73.1 SUSE-SU-2024:2939-1
SLES 15 SP5 kernel-azure +2 5.14.21-150500.33.60.1 SUSE-SU-2024:2372-1
SLES 15 SP5 kernel-default-base 5.14.21-150500.55.73.1.150500.6.33.8 SUSE-SU-2024:2939-1
SLES 15 SP5 kernel-docs 5.14.21-150500.55.73.2 SUSE-SU-2024:2939-1
Show 6 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SLE Micro 6.0 kernel-default-base 6.4.0-17.1.1.51 SUSE-SU-2025:20008-1
SLE Micro 6.0 kernel-rt +1 6.4.0-9.1 SUSE-SU-2025:20028-1
SLE Micro 6.0 kernel-source +2 6.4.0-18.1 SUSE-SU-2025:20008-1
SLE Micro 5.5 kernel-default 5.14.21-150500.55.73.1 SUSE-SU-2024:2939-1
SLE Micro 5.5 kernel-default-base 5.14.21-150500.55.73.1.150500.6.33.8 SUSE-SU-2024:2939-1
SLE Micro 5.5 kernel-rt +1 5.14.21-150500.13.61.1 SUSE-SU-2024:2394-1
SLE Live Patching 15 SP6 kernel-default 6.4.0-150600.23.14.2 SUSE-SU-2024:2571-1
SLE Live Patching 15 SP6 kernel-livepatch-SLE15-SP6-RT_Update_1 1-150600.1.5.1 SUSE-SU-2024:2973-1
SLE Live Patching 15 SP6 kernel-livepatch-SLE15-SP6_Update_2 1-150600.13.3.2 SUSE-SU-2024:2571-1
SLE Live Patching 15 SP5 kernel-default 5.14.21-150500.55.73.1 SUSE-SU-2024:2939-1
SLE Live Patching 15 SP5 kernel-livepatch-SLE15-SP5_Update_17 +1 1-150500.11.3.1 SUSE-SU-2024:2939-1, SUSE-SU-2024:2394-1
SUSE Real Time Module 15 SP6 kernel-rt +3 6.4.0-150600.10.5.1 SUSE-SU-2024:2973-1
SUSE Real Time Module 15 SP5 kernel-rt +3 5.14.21-150500.13.61.1 SUSE-SU-2024:2394-1
ReleasePackageFixed inAdvisory
openSUSE Leap 15.6 dtb-aarch64 +1 6.4.0-150600.23.14.1 SUSE-SU-2024:2571-1
openSUSE Leap 15.6 kernel-azure +1 6.4.0-150600.8.8.2 SUSE-SU-2024:2896-1
openSUSE Leap 15.6 kernel-default-base 6.4.0-150600.23.14.2.150600.12.4.3 SUSE-SU-2024:2571-1
openSUSE Leap 15.6 kernel-docs +8 6.4.0-150600.23.14.2 SUSE-SU-2024:2571-1
openSUSE Leap 15.6 kernel-rt +3 6.4.0-150600.10.5.1 SUSE-SU-2024:2973-1
openSUSE Leap 15.6 kernel-syms-azure 6.4.0-150600.8.8.1 SUSE-SU-2024:2896-1
openSUSE Leap 15.5 dtb-aarch64 +9 5.14.21-150500.55.73.1 SUSE-SU-2024:2939-1
openSUSE Leap 15.5 kernel-azure +2 5.14.21-150500.33.60.1 SUSE-SU-2024:2372-1
openSUSE Leap 15.5 kernel-default-base 5.14.21-150500.55.73.1.150500.6.33.8 SUSE-SU-2024:2939-1
openSUSE Leap 15.5 kernel-docs 5.14.21-150500.55.73.2 SUSE-SU-2024:2939-1
openSUSE Leap 15.5 kernel-rt +3 5.14.21-150500.13.61.1 SUSE-SU-2024:2394-1
Show 1 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
openSUSE Leap Micro 5.5 kernel-default 5.14.21-150500.55.73.1 SUSE-SU-2024:2939-1
openSUSE Leap Micro 5.5 kernel-default-base 5.14.21-150500.55.73.1.150500.6.33.8 SUSE-SU-2024:2939-1

Azure Linux

ReleasePackageFixed inAdvisory
Azure Linux 2 (CBL-Mariner) kernel 5.15.182.1-1 —

Oracle Linux

ReleasePackageFixed inAdvisory
Oracle Linux 9 bpftool 7.3.0-427.33.1.el9_4 ELSA-2024-5928
Oracle Linux 9 rv +27 5.14.0-427.33.1.el9_4 ELSA-2024-5928
Oracle Linux 8 kernel-uek +17 5.15.0-310.184.5.2.el9uek ELSA-2025-20470
Oracle Linux 8 perf +19 4.18.0-553.27.1.el8_10 ELSA-2025-20470, ELSA-2024-8856

Advisories 41

References