CVE-2021-46980

See a problem?
Source
https://nvd.nist.gov/vuln/detail/CVE-2021-46980
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-46980.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2021-46980
Related
Published
2024-02-28T09:15:37Z
Modified
2024-09-18T01:00:21Z
Summary
[none]
Details

In the Linux kernel, the following vulnerability has been resolved:

usb: typec: ucsi: Retrieve all the PDOs instead of just the first 4

commit 4dbc6a4ef06d ("usb: typec: ucsi: save power data objects in PD mode") introduced retrieval of the PDOs when connected to a PD-capable source. But only the first 4 PDOs are received since that is the maximum number that can be fetched at a time given the MESSAGE_IN length limitation (16 bytes). However, as per the PD spec a connected source may advertise up to a maximum of 7 PDOs.

If such a source is connected it's possible the PPM could have negotiated a power contract with one of the PDOs at index greater than 4, and would be reflected in the request data object's (RDO) object position field. This would result in an out-of-bounds access when the rdoindex() is used to index into the srcpdos array in ucsipsygetvoltagenow().

With the help of the UBSAN -fsanitize=array-bounds checker enabled this exact issue is revealed when connecting to a PD source adapter that advertise 5 PDOs and the PPM enters a contract having selected the 5th one.

[ 151.545106][ T70] Unexpected kernel BRK exception at EL1 [ 151.545112][ T70] Internal error: BRK handler: f2005512 [#1] PREEMPT SMP ... [ 151.545499][ T70] pc : ucsipsygetprop+0x208/0x20c [ 151.545507][ T70] lr : powersupplyshowproperty+0xc0/0x328 ... [ 151.545542][ T70] Call trace: [ 151.545544][ T70] ucsipsygetprop+0x208/0x20c [ 151.545546][ T70] powersupplyuevent+0x1a4/0x2f0 [ 151.545550][ T70] devuevent+0x200/0x384 [ 151.545555][ T70] kobjectueventenv+0x1d4/0x7e8 [ 151.545557][ T70] powersupplychangedwork+0x174/0x31c [ 151.545562][ T70] processonework+0x244/0x6f0 [ 151.545564][ T70] workerthread+0x3e0/0xa64

We can resolve this by instead retrieving and storing up to the maximum of 7 PDOs in the con->srcpdos array. This would involve two calls to the GETPDOS command.

References

Affected packages

Debian:11 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
5.10.38-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Debian:12 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
5.10.38-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Debian:13 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
5.10.38-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}