CVE-2022-49926

Source
https://cve.org/CVERecord?id=CVE-2022-49926
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-49926.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2022-49926
Downstream
Published
2025-05-01T14:11:04.691Z
Modified
2026-04-02T08:28:03.453666Z
Severity
  • 5.5 (Medium) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H CVSS Calculator
Summary
net: dsa: Fix possible memory leaks in dsa_loop_init()
Details

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

net: dsa: Fix possible memory leaks in dsaloopinit()

kmemleak reported memory leaks in dsaloopinit():

kmemleak: 12 new suspected memory leaks

unreferenced object 0xffff8880138ce000 (size 2048): comm "modprobe", pid 390, jiffies 4295040478 (age 238.976s) backtrace: [<000000006a94f1d5>] kmalloctrace+0x26/0x60 [<00000000a9c44622>] phydevicecreate+0x5d/0x970 [<00000000d0ee2afc>] getphy_device+0xf3/0x2b0 [<00000000dca0c71f>] _fixedphyregister.part.0+0x92/0x4e0 [<000000008a834798>] fixedphyregister+0x84/0xb0 [<0000000055223fcb>] dsaloopinit+0xa9/0x116 [dsaloop] ...

There are two reasons for memleak in dsaloopinit().

First, fixedphyregister() create and register phy_device:

fixedphyregister() getphydevice() phydevicecreate() # freed by phydevicefree() phydeviceregister() # freed by phydeviceremove()

But fixedphyunregister() only calls phydeviceremove(). So the memory allocated in phydevicecreate() is leaked.

Second, when mdiodriverregister() fail in dsaloopinit(), it just returns and there is no cleanup for phydevs.

Fix the problems by catching the error of mdiodriverregister() in dsaloopinit(), then calling both fixedphyunregister() and phydevicefree() to release phydevs. Also add a function for phydevs cleanup to avoid duplacate.

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/49xxx/CVE-2022-49926.json"
}
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
98cd1552ea27e512c7e99e2aa76042a26e4fb25c
Fixed
935b4beb724946a37cebf97191592d4879d3a3a3
Fixed
d593e1ede655b74c42e4e4fe285ea64aee96fb5c
Fixed
bbc5d7b46a729bfcbb5544f6612b7a67dd4f4d6f
Fixed
37a098fc9b42bd7fce66764866aa514639667b6e
Fixed
9f555b1584fc2d5d16ee3c4d9438e93ac7c502c7
Fixed
4d2024b138d9f7b02ae13ee997fd3a71e9e46254
Fixed
633efc8b3dc96f56f5a57f2a49764853a2fa3f50

Database specific

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