CVE-2024-50226: cxl/port: Fix use-after-free, permit out-of-order decoder shutdown

Published Nov 9, 2024
·
Updated

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

cxl/port: Fix use-after-free, permit out-of-order decoder shutdown

In support of investigating an initialization failure report [1], cxltest was updated to register mock memory-devices after the mock root-port/bus device had been registered. That led to cxltest crashing with a use-after-free bug with the following signature:

cxlportattachregion: cxl region3: cxlhostbridge.0:port3 decoder3.0 add: mem0:decoder7.0 @ 0 next: cxlswitchuport.0 nreps: 1 nrtargets: 1 cxlportattachregion: cxl region3: cxlhostbridge.0:port3 decoder3.0 add: mem4:decoder14.0 @ 1 next: cxlswitchuport.0 nreps: 2 nrtargets: 1 cxlportsetuptargets: cxl region3: cxlswitchuport.0:port6 target[0] = cxlswitchdport.0 for mem0:decoder7.0 @ 0 1) cxlportsetuptargets: cxl region3: cxlswitchuport.0:port6 target[1] = cxlswitchdport.4 for mem4:decoder14.0 @ 1 [..] cxldunregister: cxl decoder14.0: cxlregiondecodereset: cxlregion region3: mockdecoderreset: cxlport port3: decoder3.0 reset 2) mockdecoderreset: cxlport port3: decoder3.0: out of order reset, expected decoder3.1 cxlendpointdecoderrelease: cxl decoder14.0: [..] cxldunregister: cxl decoder7.0: 3) cxlregiondecodereset: cxlregion region3: Oops: general protection fault, probably for non-canonical address 0x6b6b6b6b6b6b6bc3: 0000 [#1] PREEMPT SMP PTI [..] RIP: 0010:tocxlport+0x8/0x60 [cxlcore] [..] Call Trace: <TASK> cxlregiondecodereset+0x69/0x190 [cxlcore] cxlregiondetach+0xe8/0x210 [cxlcore] cxldecoderkillregion+0x27/0x40 [cxlcore] cxldunregister+0x5d/0x60 [cxlcore]

At 1) a region has been established with 2 endpoint decoders (7.0 and 14.0). Those endpoints share a common switch-decoder in the topology (3.0). At teardown, 2), decoder14.0 is the first to be removed and hits the "out of order reset case" in the switch decoder. The effect though is that region3 cleanup is aborted leaving it in-tact and referencing decoder14.0. At 3) the second attempt to teardown region3 trips over the stale decoder14.0 object which has long since been deleted.

The fix here is to recognize that the CXL specification places no mandate on in-order shutdown of switch-decoders, the driver enforces in-order allocation, and hardware enforces in-order commit. So, rather than fail and leave objects dangling, always remove them.

In support of making cxlregiondecodereset() always succeed, cxlregioninvalidatememregion() failures are turned into warnings. Crashing the kernel is ok there since system integrity is at risk if caches cannot be managed around physical address mutation events like CXL region destruction.

A new deviceforeachchildreversefrom() is added to cleanup port->commitend after all dependent decoders have been disabled. In other words if decoders are allocated 0->1->2 and disabled 1->2->0 then port->commitend only decrements from 2 after 2 has been disabled, and it decrements all the way to zero since 1 was disabled previously.

Other sources

This CVE was automatically created from a reference found in an email or other text. If you are reading this, then this CVE entry is probably erroneous, since this text should be replaced by the official CVE description automatically.

Launchpad

Affected Software

8 affected componentsFixes available
Linux Linux kernel>=6.0<6.6.60
Linux Linux kernel>=6.7<6.11.7
Linux Linux kernel=6.12-rc1
Linux Linux kernel=6.12-rc2
Linux Linux kernel=6.12-rc3
Linux Linux kernel=6.12-rc4
Linux Linux kernel=6.12-rc5
debian/linux<=6.1.129-1, <=6.1.135-1
5.10.223-15.10.234-16.12.22-16.12.25-1

Event History

Nov 9, 2024
CVE Published
via MITRE·10:14 AM
Data Sourced
via MITRE·10:14 AM
Description
Data Sourced
via Red Hat·11:02 AM
DescriptionSeverityAffected Software
Feb 20, 2025
Data Sourced
via Launchpad·12:46 AM
Description
Apr 29, 2025
Data Sourced
via Ubuntu·01:00 AM
RemedyDescriptionSeverityAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2024-50226?

CVE-2024-50226 has a CVSS score indicating a medium severity due to its use-after-free vulnerability in the Linux kernel.

2

How do I fix CVE-2024-50226?

To fix CVE-2024-50226, users should update their Linux kernel to the latest version where this vulnerability has been patched.

3

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

CVE-2024-50226 affects Linux kernel versions between 6.0 and 6.6.60, as well as certain 6.12 release candidates.

4

What is the impact of CVE-2024-50226?

The impact of CVE-2024-50226 could allow an attacker to exploit the use-after-free vulnerability, potentially leading to code execution or system crashes.

5

Is CVE-2024-50226 a critical vulnerability?

CVE-2024-50226 is classified as medium severity, but it is important to address it promptly to mitigate potential risks.

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