greybus: Fix use-after-free bug in gb_interface_release due to race condition.
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 55742d2a071a569bf20f90d37b1b5b8a25a3f882 · < 03ea2b129344152157418929f06726989efc0445| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
greybus: Fix use-after-free bug in gb_interface_release due to race condition.
In gb_interface_create, &intf->mode_switch_completion is bound with gb_interface_mode_switch_work. Then it will be started by gb_interface_request_mode_switch. Here is the relevant code. if (!queue_work(system_long_wq, &intf->mode_switch_work)) { ... }
If we call gb_interface_release to make cleanup, there may be an unfinished work. This function will call kfree to free the object "intf". However, if gb_interface_mode_switch_work is scheduled to run after kfree, it may cause use-after-free error as gb_interface_mode_switch_work 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 gb_interface_release | kfree(intf) (free) | | gb_interface_mode_switch_work | mutex_lock(&intf->mutex) (use)
Fix it by canceling the work before kfree.
From the CVE record · Linux
A race in the Linux kernel’s Greybus interface handling can cause a use-after-free if interface release frees an object before queued mode-switch work runs. The input does not specify how an attacker could trigger the race or whether authentication, local access, or user interaction is required.
Engineers running Linux kernels with Greybus support should check their kernel versions; affected versions are not specified in the input.