CVE-2022-49021

Source
https://cve.org/CVERecord?id=CVE-2022-49021
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-49021.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2022-49021
Downstream
Related
Published
2024-10-21T20:06:28.608Z
Modified
2026-03-20T12:22:07.332544Z
Summary
net: phy: fix null-ptr-deref while probe() failed
Details

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

net: phy: fix null-ptr-deref while probe() failed

I got a null-ptr-deref report as following when doing fault injection test:

BUG: kernel NULL pointer dereference, address: 0000000000000058 Oops: 0000 [#1] PREEMPT SMP KASAN PTI CPU: 1 PID: 253 Comm: 507-spi-dm9051 Tainted: G B N 6.1.0-rc3+ Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 RIP: 0010:klistput+0x2d/0xd0 Call Trace: <TASK> klistremove+0xf1/0x1c0 devicereleasedriverinternal+0x23e/0x2d0 busremovedevice+0x1bd/0x240 devicedel+0x357/0x770 phydeviceremove+0x11/0x30 mdiobusunregister+0xa5/0x140 releasenodes+0x6a/0xa0 devresreleaseall+0xf8/0x150 deviceunbindcleanup+0x19/0xd0

//probe path: phydeviceregister() device_add()

phyconnect phyattachdirect() //set device driver probe() //it's failed, driver is not bound devicebind_driver() // probe failed, it's not called

//remove path: phydeviceremove() devicedel() devicereleasedriverinternal() __devicereleasedriver() //dev->drv is not NULL klistremove() <- knodedriver is not added yet, cause null-ptr-deref

In phyattachdirect(), after setting the 'dev->driver', probe() fails, devicebinddriver() is not called, so the knodedriver->nklist is not set, then it causes null-ptr-deref in __devicereleasedriver() while deleting device. Fix this by setting dev->driver to NULL in the error path in phyattachdirect().

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/49xxx/CVE-2022-49021.json",
    "cna_assigner": "Linux"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
e13934563db047043ccead26412f552375cea90c
Fixed
8aaafe0f71314f46a066382a047ba8bb3840d273
Fixed
51d7f6b20fae8bae64ad1136f1e30d1fd5ba78f7
Fixed
0744c7be4de564db03e24527b2e096b7e0e20972
Fixed
3e21f85d87c836462bb52ef2078ea561260935c1
Fixed
fe6bc99c27c21348f548966118867ed26a9a372c
Fixed
7730904f50c7187dd16c76949efb56b5fb55cd57
Fixed
eaa5722549ac2604ffa56c2e946acc83226f130c
Fixed
369eb2c9f1f72adbe91e0ea8efb130f0a2ba11a6

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-49021.json"