CVE-2022-50045

Source
https://nvd.nist.gov/vuln/detail/CVE-2022-50045
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-50045.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2022-50045
Related
Published
2025-06-18T11:15:33Z
Modified
2025-06-18T16:47:48.114747Z
Downstream
Summary
[none]
Details

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

powerpc/pci: Fix getphbnumber() locking

The recent change to getphbnumber() causes a DEBUGATOMICSLEEP warning on some systems:

BUG: sleeping function called from invalid context at kernel/locking/mutex.c:580 inatomic(): 1, irqsdisabled(): 0, nonblock: 0, pid: 1, name: swapper preemptcount: 1, expected: 0 RCU nest depth: 0, expected: 0 1 lock held by swapper/1: #0: c157efb0 (hosespinlock){+.+.}-{2:2}, at: pcibiosalloccontroller+0x64/0x220 Preemption disabled at: [<00000000>] 0x0 CPU: 0 PID: 1 Comm: swapper Not tainted 5.19.0-yocto-standard+ #1 Call Trace: [d101dc90] [c073b264] dumpstacklvl+0x50/0x8c (unreliable) [d101dcb0] [c0093b70] _mightresched+0x258/0x2a8 [d101dcd0] [c0d3e634] _mutexlock+0x6c/0x6ec [d101dd50] [c0a84174] ofaliasgetid+0x50/0xf4 [d101dd80] [c002ec78] pcibiosalloccontroller+0x1b8/0x220 [d101ddd0] [c140c9dc] pmacpciinit+0x198/0x784 [d101de50] [c140852c] discoverphbs+0x30/0x4c [d101de60] [c0007fd4] dooneinitcall+0x94/0x344 [d101ded0] [c1403b40] kernelinitfreeable+0x1a8/0x22c [d101df10] [c00086e0] kernelinit+0x34/0x160 [d101df30] [c001b334] retfromkernel_thread+0x5c/0x64

This is because pcibiosalloccontroller() holds hosespinlock but ofaliasgetid() takes of_mutex which can sleep.

The hosespinlock protects the phbbitmap, and also the hoselist, but it doesn't need to be held while getphb_number() calls the OF routines, because those are only looking up information in the device tree.

So fix it by having getphbnumber() take the hosespinlock itself, only where required, and then dropping the lock before returning. pcibiosalloccontroller() then needs to take the lock again before the listadd() but that's safe, the order of the list is not important.

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.140-1

Affected versions

5.*

5.10.46-4
5.10.46-5
5.10.70-1~bpo10+1
5.10.70-1
5.10.84-1
5.10.92-1~bpo10+1
5.10.92-1
5.10.92-2
5.10.103-1~bpo10+1
5.10.103-1
5.10.106-1
5.10.113-1
5.10.120-1~bpo10+1
5.10.120-1
5.10.127-1
5.10.127-2~bpo10+1
5.10.127-2
5.10.136-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
6.0.2-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
6.0.2-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}