{"id":"CVE-2026-138843","summary":"usb: typec: ucsi: ccg: Validate altmode index in GET_CURRENT_CAM response","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nusb: typec: ucsi: ccg: Validate altmode index in GET_CURRENT_CAM response\n\nWhen the PPM reports more than one DisplayPort alternate mode for a\nconnector, ucsi_ccg_update_altmodes() merges them into a single entry\nin uc-\u003eupdated[] and sets uc-\u003ehas_multiple_dp. In that case,\nucsi_ccg_update_get_current_cam_cmd() rewrites the response of the\nGET_CURRENT_CAM command. The response is a single byte holding the\nindex of the currently active alternate mode, and it is provided by\nthe PPM firmware.\n\nThe function uses this byte directly as an index into uc-\u003eorig[], and\nthen uses the linked_idx read from that entry as the translated index\ninto uc-\u003eupdated[]. Both arrays have UCSI_MAX_ALTMODES entries, but\nneither index is checked against that size.\n\nIf a malicious or buggy PPM reports a value of UCSI_MAX_ALTMODES or\nlarger, e.g. 0xFF, uc-\u003eorig[cam].linked_idx reads over the end of\nuc-\u003eorig[]. The byte read from there is then used as the index for\nwriting cam into uc-\u003eupdated[new_cam].active_idx, so the out-of-bounds\nread is followed by an out-of-bounds write. This happens without any\nuserspace action, since the UCSI core issues GET_CURRENT_CAM on its own\nwhen handling connector changes.\n\nFix this by rejecting responses whose index is out of range, printing an\nerror and returning -EPROTO, so that the caller cannot accept this.\nAlso check linked_idx before using it as an index, so that the write into\nuc-\u003eupdated[] is always within bounds.\n\nThe response is now only processed when the command completed without\nan error. ucsi_sync_control_common() only reads the response when the\nCCI reports command completion, so otherwise the buffer is not filled\nand must not be mistaken for an invalid index.\n\nThis bug was found with a Python script that traces where firmware input\nis used.","modified":"2026-11-30T15:01:04.451956172Z","published":"2026-11-30T13:25:30.059Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/138xxx/CVE-2026-138843.json","cna_assigner":"Linux"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/02ee864e8d2142c5648998944c3306ea6a763c26"},{"type":"WEB","url":"https://git.kernel.org/stable/c/24376aa9ad111077bd018796ba22848db52db920"},{"type":"WEB","url":"https://git.kernel.org/stable/c/5d254d1e59da5b4bb05025924220faabb255b48f"},{"type":"WEB","url":"https://git.kernel.org/stable/c/7eae4d201b568ee3a6dc5f143b5f5ee9563c3d60"},{"type":"WEB","url":"https://git.kernel.org/stable/c/8e3cb6de2c5108cad19541055b60fc4400f97dde"},{"type":"WEB","url":"https://git.kernel.org/stable/c/906bd29c833c0c21835da69044b85b9dce723f80"},{"type":"WEB","url":"https://git.kernel.org/stable/c/9b73d02a9d5d56efa4528622370db1e364628b24"},{"type":"WEB","url":"https://git.kernel.org/stable/c/b46052b769919a02b1be360a93ff9379b1a5fd49"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/138xxx/CVE-2026-138843.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-138843"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"170a6726d0e266f2c8f306e3d61715c32f4ee41e"},{"fixed":"24376aa9ad111077bd018796ba22848db52db920"},{"fixed":"9b73d02a9d5d56efa4528622370db1e364628b24"},{"fixed":"b46052b769919a02b1be360a93ff9379b1a5fd49"},{"fixed":"906bd29c833c0c21835da69044b85b9dce723f80"},{"fixed":"7eae4d201b568ee3a6dc5f143b5f5ee9563c3d60"},{"fixed":"5d254d1e59da5b4bb05025924220faabb255b48f"},{"fixed":"8e3cb6de2c5108cad19541055b60fc4400f97dde"},{"fixed":"02ee864e8d2142c5648998944c3306ea6a763c26"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-138843.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.6.0"},{"fixed":"5.10.275"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.11.0"},{"fixed":"5.15.226"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.16.0"},{"fixed":"6.1.193"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.2.0"},{"fixed":"6.6.163"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.7.0"},{"fixed":"6.12.118"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.63"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.4"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-138843.json"}}],"schema_version":"1.9.2"}