CVE-2024-39495

Source
https://cve.org/CVERecord?id=CVE-2024-39495
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-39495.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2024-39495
Downstream
Published
2024-07-12T12:20:31.022Z
Modified
2026-03-14T12:34:44.757661Z
Severity
  • 7.8 (High) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H CVSS Calculator
Summary
greybus: Fix use-after-free bug in gb_interface_release due to race condition.
Details

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

greybus: Fix use-after-free bug in gbinterfacerelease due to race condition.

In gbinterfacecreate, &intf->modeswitchcompletion is bound with gbinterfacemodeswitchwork. Then it will be started by gbinterfacerequestmodeswitch. Here is the relevant code. if (!queuework(systemlongwq, &intf->modeswitch_work)) { ... }

If we call gbinterfacerelease to make cleanup, there may be an unfinished work. This function will call kfree to free the object "intf". However, if gbinterfacemodeswitchwork is scheduled to run after kfree, it may cause use-after-free error as gbinterfacemodeswitchwork will use the object "intf". The possible execution flow that may lead to the issue is as follows:

CPU0 CPU1

                        |   gb_interface_create
                        |   gb_interface_request_mode_switch

gbinterfacerelease | kfree(intf) (free) | | gbinterfacemodeswitchwork | mutex_lock(&intf->mutex) (use)

Fix it by canceling the work before kfree.

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/39xxx/CVE-2024-39495.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
55742d2a071a569bf20f90d37b1b5b8a25a3f882
Fixed
74cd0a421896b2e07eafe7da4275302bfecef201
Fixed
2b6bb0b4abfd79b8698ee161bb73c0936a2aaf83
Fixed
fb071f5c75d4b1c177824de74ee75f9dd34123b9
Fixed
9a733d69a4a59c2d08620e6589d823c24be773dc
Fixed
0b8fba38bdfb848fac52e71270b2aa3538c996ea
Fixed
03ea2b129344152157418929f06726989efc0445
Fixed
5c9c5d7f26acc2c669c1dcf57d1bb43ee99220ce

Database specific

source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-39495.json"