CVE-2021-46959

Source
https://nvd.nist.gov/vuln/detail/CVE-2021-46959
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2021-46959.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2021-46959
Related
Published
2024-02-29T23:15:07Z
Modified
2024-09-11T02:00:06Z
Summary
[none]
Details

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

spi: Fix use-after-free with devmspialloc_*

We can't rely on the contents of the devres list during spiunregistercontroller(), as the list is already torn down at the time we perform devresfind() for devmspireleasecontroller. This causes devices registered with devmspialloc_{master,slave}() to be mistakenly identified as legacy, non-devm managed devices and have their reference counters decremented below 0.

------------[ cut here ]------------ WARNING: CPU: 1 PID: 660 at lib/refcount.c:28 refcountwarnsaturate+0x108/0x174 [<b0396f04>] (refcountwarnsaturate) from [<b03c56a4>] (kobjectput+0x90/0x98) [<b03c5614>] (kobjectput) from [<b0447b4c>] (putdevice+0x20/0x24) r4:b6700140 [<b0447b2c>] (putdevice) from [<b07515e8>] (devmspireleasecontroller+0x3c/0x40) [<b07515ac>] (devmspireleasecontroller) from [<b045343c>] (releasenodes+0x84/0xc4) r5:b6700180 r4:b6700100 [<b04533b8>] (releasenodes) from [<b0454160>] (devresreleaseall+0x5c/0x60) r8:b1638c54 r7:b117ad94 r6:b1638c10 r5:b117ad94 r4:b163dc10 [<b0454104>] (devresreleaseall) from [<b044e41c>] (devicereleasedriver+0x144/0x1ec) r5:b117ad94 r4:b163dc10 [<b044e2d8>] (devicereleasedriver) from [<b044f70c>] (devicedriverdetach+0x84/0xa0) r9:00000000 r8:00000000 r7:b117ad94 r6:b163dc54 r5:b1638c10 r4:b163dc10 [<b044f688>] (devicedriverdetach) from [<b044d274>] (unbind_store+0xe4/0xf8)

Instead, determine the devm allocation state as a flag on the controller which is guaranteed to be stable during cleanup.

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"
}