scsi: mpt3sas: Avoid test/set_bit() operating in non-allocated memory
Published Jul 12, 2024
7.8
HIGHCVSS 3.1
EPSS 0.31%
Description
There is a potential out-of-bounds access when using test_bit() on a single word. The test_bit() and set_bit() functions operate on long values, and when testing or setting a single word, they can exceed the word boundary. KASAN detects this issue and produces a dump:
BUG: KASAN: slab-out-of-bounds in _scsih_add_device.constprop.0 (./arch/x86/include/asm/bitops.h:60 ./include/asm-generic/bitops/instrumented-atomic.h:29 drivers/scsi/mpt3sas/mpt3sas_scsih.c:7331) mpt3sas
Write of size 8 at addr ffff8881d26e3c60 by task kworker/u1536:2/2965
For full log, please look at [1].
Make the allocation at least the size of sizeof(unsigned long) so that set_bit() and test_bit() have sufficient room for read/write operations without overwriting unallocated memory.
[1] Link: https://lore.kernel.org/all/ZkNcALr3W3KGYYJG@gmail.com/
Affected products
-
- Version StatusaffectedConstraints
- Version StatusaffectedConstraints
- Version StatusaffectedConstraints
- Version StatusaffectedConstraints
- Version StatusaffectedConstraints
- Version StatusaffectedConstraints
- Version StatusaffectedConstraints
- Version StatusaffectedConstraints
- Version
-
- Version 4.10StatusaffectedConstraints-
- Version 0StatusunaffectedConstraints<4.10
- Version 4.19.317StatusunaffectedConstraints<=4.19.*
- Version 5.10.221StatusunaffectedConstraints<=5.10.*
- Version 5.15.162StatusunaffectedConstraints<=5.15.*
- Version 5.4.279StatusunaffectedConstraints<=5.4.*
- Version 6.1.95StatusunaffectedConstraints<=6.1.*
- Version 6.10StatusunaffectedConstraints<=*
- Version 6.6.35StatusunaffectedConstraints<=6.6.*
- Version 6.9.6StatusunaffectedConstraints<=6.9.*
- Version
Default status is the baseline for the product, each version can override it (e.g. patched versions marked unaffected).
| Vendor | Product | Default status | Versions | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Linux | Linux | unaffected |
| |||||||||||||||||||||||||||||||||
| Linux | Linux | affected |
|
- ≥ 4.10 · < 4.19.317
- ≥ 4.20 · < 5.4.279
- ≥ 5.5 · < 5.10.221
- ≥ 5.11 · < 5.15.162
- ≥ 5.16 · < 6.1.95
- ≥ 6.2 · < 6.6.35
- ≥ 6.7 · < 6.9.6
- 6.10
- 6.10
- 6.10
No data.
Red Hat Enterprise Linux 8
kernel-0:4.18.0-553.22.1.el8_10
Fixed · RHSA-2024:7000
Red Hat Enterprise Linux 8
kernel-rt-0:4.18.0-553.22.1.rt7.363.el8_10
Fixed · RHSA-2024:7001
Red Hat Enterprise Linux 9
kernel-0:5.14.0-503.11.1.el9_5
Fixed · RHSA-2024:9315
Red Hat Enterprise Linux 9
kernel-0:5.14.0-503.11.1.el9_5
Fixed · RHSA-2024:9315
Red Hat Enterprise Linux 9.4 Extended Update Support
kernel-0:5.14.0-427.44.1.el9_4
Fixed · RHSA-2024:9546
Red Hat Enterprise Linux 6
kernel
Out of support scope
Red Hat Enterprise Linux 7
kernel
Out of support scope
Red Hat Enterprise Linux 7
kernel-rt
Out of support scope
Red Hat Enterprise Linux 9
kernel-rt
Affected
| Product | Package | State | Advisory |
|---|---|---|---|
| Red Hat Enterprise Linux 8 | kernel-0:4.18.0-553.22.1.el8_10 | Fixed | RHSA-2024:7000 |
| Red Hat Enterprise Linux 8 | kernel-rt-0:4.18.0-553.22.1.rt7.363.el8_10 | Fixed | RHSA-2024:7001 |
| Red Hat Enterprise Linux 9 | kernel-0:5.14.0-503.11.1.el9_5 | Fixed | RHSA-2024:9315 |
| Red Hat Enterprise Linux 9 | kernel-0:5.14.0-503.11.1.el9_5 | Fixed | RHSA-2024:9315 |
| Red Hat Enterprise Linux 9.4 Extended Update Support | kernel-0:5.14.0-427.44.1.el9_4 | Fixed | RHSA-2024:9546 |
| Red Hat Enterprise Linux 6 | kernel | Out of support scope | n/a |
| Red Hat Enterprise Linux 7 | kernel | Out of support scope | n/a |
| Red Hat Enterprise Linux 7 | kernel-rt | Out of support scope | n/a |
| Red Hat Enterprise Linux 9 | kernel-rt | Affected | n/a |
No package ranges for this CVE.
Remediation
No remediation recorded yet.
References (15)
- https://access.redhat.com/security/cve/CVE-2024-40901 Vendor Advisory
- https://bugzilla.redhat.com/show_bug.cgi?id=2297706 Issue Tracking
- https://euvd.enisa.europa.eu/vulnerability/EUVD-2024-38712 Advisory
- https://git.kernel.org/stable/c/0081d2b3ae0a17a86b8cc0fa3c8bdc54e233ba16 Mailing ListPatch
- https://git.kernel.org/stable/c/18abb5db0aa9b2d48f7037a88b41af2eef821674 Mailing ListPatch
- https://git.kernel.org/stable/c/19649e49a6df07cd2e03e0a11396fd3a99485ec2 Mailing ListPatch
- https://git.kernel.org/stable/c/4254dfeda82f20844299dca6c38cbffcfd499f41 Mailing ListPatch
- https://git.kernel.org/stable/c/46bab2bcd771e725ff5ca3a68ba68cfeac45676c Mailing ListPatch
- https://git.kernel.org/stable/c/521f333e644c4246ca04a4fc4772edc53dd2a801 Mailing ListPatch
- https://git.kernel.org/stable/c/9079338c5a0d1f1fee34fb1c9e99b754efe414c5 Mailing ListPatch
- https://git.kernel.org/stable/c/e9bce7c751f6d6c7be88c0bc081a66aaf61a23ee Mailing ListPatch
- https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html
- https://lore.kernel.org/linux-cve-announce/2024071207-CVE-2024-40901-05c4@gregkh/T
- https://nvd.nist.gov/vuln/detail/CVE-2024-40901
- https://www.cve.org/CVERecord?id=CVE-2024-40901
Change history (0)
No recorded changes yet.