CVE-2024-35977
Severity CVSS v4.0:
Pending analysis
Type:
CWE-362
Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
Publication date:
20/05/2024
Last modified:
14/01/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
platform/chrome: cros_ec_uart: properly fix race condition<br />
<br />
The cros_ec_uart_probe() function calls devm_serdev_device_open() before<br />
it calls serdev_device_set_client_ops(). This can trigger a NULL pointer<br />
dereference:<br />
<br />
BUG: kernel NULL pointer dereference, address: 0000000000000000<br />
...<br />
Call Trace:<br />
<br />
...<br />
? ttyport_receive_buf<br />
<br />
A simplified version of crashing code is as follows:<br />
<br />
static inline size_t serdev_controller_receive_buf(struct serdev_controller *ctrl,<br />
const u8 *data,<br />
size_t count)<br />
{<br />
struct serdev_device *serdev = ctrl->serdev;<br />
<br />
if (!serdev || !serdev->ops->receive_buf) // CRASH!<br />
return 0;<br />
<br />
return serdev->ops->receive_buf(serdev, data, count);<br />
}<br />
<br />
It assumes that if SERPORT_ACTIVE is set and serdev exists, serdev->ops<br />
will also exist. This conflicts with the existing cros_ec_uart_probe()<br />
logic, as it first calls devm_serdev_device_open() (which sets<br />
SERPORT_ACTIVE), and only later sets serdev->ops via<br />
serdev_device_set_client_ops().<br />
<br />
Commit 01f95d42b8f4 ("platform/chrome: cros_ec_uart: fix race<br />
condition") attempted to fix a similar race condition, but while doing<br />
so, made the window of error for this race condition to happen much<br />
wider.<br />
<br />
Attempt to fix the race condition again, making sure we fully setup<br />
before calling devm_serdev_device_open().
Impact
Base Score 3.x
4.70
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.3 (including) | 6.6.28 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.8.7 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.9:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.9:rc2:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.9:rc3:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/5e700b384ec13f5bcac9855cb28fcc674f1d3593
- https://git.kernel.org/stable/c/9e9bb74a93b7daa32313ccaefd0edc529d40daf8
- https://git.kernel.org/stable/c/cfd758041d8b79aa8c3f811b6bd6105379f2f702
- https://git.kernel.org/stable/c/5e700b384ec13f5bcac9855cb28fcc674f1d3593
- https://git.kernel.org/stable/c/9e9bb74a93b7daa32313ccaefd0edc529d40daf8
- https://git.kernel.org/stable/c/cfd758041d8b79aa8c3f811b6bd6105379f2f702



