CVE-2022-49926: net: dsa: Fix possible memory leaks in dsa_loop_init()
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>] getphydevice+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 phydevice:
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.
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2022-49926?
CVE-2022-49926 has been classified with medium severity due to potential memory leaks in the Linux kernel.
How do I fix CVE-2022-49926?
To fix CVE-2022-49926, update your Linux kernel to the latest stable version that includes the patch addressing this vulnerability.
What is affected by CVE-2022-49926?
CVE-2022-49926 affects the Linux Kernel, specifically the networking subsystem handling DSA.
What kind of vulnerability is CVE-2022-49926?
CVE-2022-49926 is a memory leak vulnerability in the dsa_loop_init() function within the Linux kernel.
Is CVE-2022-49926 exploitable?
While CVE-2022-49926 is primarily a memory leak issue, unauthorized access could be exploited in specific conditions depending on the system configuration.