CVE-2022-49902: block: Fix possible memory leak for rq_wb on add_disk failure
In the Linux kernel, the following vulnerability has been resolved:
block: Fix possible memory leak for rqwb on adddisk failure
kmemleak reported memory leaks in deviceadddisk():
kmemleak: 3 new suspected memory leaks
unreferenced object 0xffff88800f420800 (size 512): comm "modprobe", pid 4275, jiffies 4295639067 (age 223.512s) hex dump (first 32 bytes): 04 00 00 00 08 00 00 00 01 00 00 00 00 00 00 00 ................ 00 e1 f5 05 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000d3662699>] kmalloctrace+0x26/0x60 [<00000000edc7aadc>] wbtinit+0x50/0x6f0 [<0000000069601d16>] wbtenabledefault+0x157/0x1c0 [<0000000028fc393f>] blkregisterqueue+0x2a4/0x420 [<000000007345a042>] deviceadddisk+0x6fd/0xe40 [<0000000060e6aab0>] nbddevadd+0x828/0xbf0 [nbd] ...
It is because the memory allocated in wbtenabledefault() is not released in deviceadddisk() error path. Normally, these memory are freed in:
delgendisk() rqqosexit() rqos->ops->exit(rqos); wbtexit()
So rqqosexit() is called to free the rqwb memory for wbtinit(). However in the error path of deviceadddisk(), only blkunregisterqueue() is called and make rqwb memory leaked.
Add rqqosexit() to the error path to fix it.
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2022-49902?
CVE-2022-49902 has been classified as a low severity vulnerability.
How do I fix CVE-2022-49902?
You can resolve CVE-2022-49902 by applying the latest updates to the Linux kernel that address the memory leak issue.
Which versions of Linux Kernel are affected by CVE-2022-49902?
CVE-2022-49902 affects certain versions of the Linux kernel prior to the fix being applied.
What type of vulnerability is CVE-2022-49902?
CVE-2022-49902 is a memory leak vulnerability occurring in the block subsystem of the Linux kernel.
Can CVE-2022-49902 impact system performance?
Yes, CVE-2022-49902 may lead to performance degradation over time due to unfreed memory allocations.