coresight: platform: defer connection counter increment until alloc succeeds
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
coresight: platform: defer connection counter increment until alloc succeeds
coresight_add_out_conn() increments nr_outconns before calling devm_krealloc_array() and again before devm_kmalloc(). If either allocation fails, the counter is already bumped while the corresponding array entry is NULL or uninitialized garbage.
coresight_add_in_conn() has the same problem with nr_inconns and devm_krealloc_array().
In both cases the probe returns -ENOMEM, which causes coresight_get_platform_data() to call coresight_release_platform_data() for cleanup. That function iterates up to nr_outconns (or nr_inconns) entries and dereferences each pointer unconditionally, hitting the NULL or garbage entry and panicking instead of failing gracefully.
Fix by moving the counter increments to after all allocations succeed, so the struct is always consistent on any error path.
From the CVE record · Linux
The Linux kernel’s CoreSight platform code can leave connection counters inconsistent if memory allocation fails during device probing. Cleanup can then dereference a NULL or uninitialized entry and panic the kernel. The input does not establish an attacker path, authentication requirement, or user interaction requirement.
Engineers running Linux kernels with the CoreSight platform code should check their kernel versions; affected versions were not provided.