platform/chrome: cros_ec_typec: Reject out-of-bounds PD cap count
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 348a2e8c93d3ca622cf1b293cd2f597c9db74d9d · < a0a8cd9fc9c48b95095bcec4b146f7a99486f58e| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
platform/chrome: cros_ec_typec: Reject out-of-bounds PD cap count
cros_typec_register_partner_pdos() copies the partner PDOs from the EC TYPEC_STATUS response into the fixed caps_desc.pdo[PDO_MAX_OBJECTS] array.
memcpy(caps_desc.pdo, resp->source_cap_pdos, sizeof(u32) * resp->source_cap_count); ... memcpy(caps_desc.pdo, resp->sink_cap_pdos, sizeof(u32) * resp->sink_cap_count);
PDO_MAX_OBJECTS is 7. source_cap_count and sink_cap_count are u8 fields from the EC. The only check is that they are not both zero. If either is larger than 7, the memcpy writes past the end of the array on the stack. A count of 255 overflows it by about 1 KB. The EC source arrays are only seven entries wide. A larger count reads past them too.
The ChromeOS EC firmware caps these counts today, so a compliant setup does not hit this. The kernel should still validate these values rather than trust them.
Validate the counts in cros_typec_register_partner_pdos() next to the memcpy. Skip the PDO registration if either count is above PDO_MAX_OBJECTS. The rest of cros_typec_handle_status() still runs so events are handled and cleared.
From the CVE record · Linux
The Linux kernel’s ChromeOS EC Type-C driver copies partner power capabilities into a fixed-size stack array without checking the counts reported by the EC. If either count exceeds seven, the copy can read beyond the EC response array and overwrite the stack array. Exploitation would require causing the EC to report an oversized count; the input does not establish a network path, authentication requirement, or user interaction.
Engineers running Linux kernels with the ChromeOS EC Type-C driver should check their exposure; affected versions are not specified.