CVE-2022-49901: blk-mq: Fix kmemleak in blk_mq_init_allocated_queue

Published May 1, 2025
·
Updated

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

blk-mq: Fix kmemleak in blkmqinitallocatedqueue

There is a kmemleak caused by modprobe nullblk.ko

unreferenced object 0xffff8881acb1f000 (size 1024): comm "modprobe", pid 836, jiffies 4294971190 (age 27.068s) hex dump (first 32 bytes): 00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00 .....N.......... ff ff ff ff ff ff ff ff 00 53 99 9e ff ff ff ff .........S...... backtrace: [<000000004a10c249>] kmallocnodetrace+0x22/0x60 [<00000000648f7950>] blkmqallocandinithctx+0x289/0x350 [<00000000af06de0e>] blkmqreallochwctxs+0x2fe/0x3d0 [<00000000e00c1872>] blkmqinitallocatedqueue+0x48c/0x1440 [<00000000d16b4e68>] blkmqallocdisk+0xc8/0x1c0 [<00000000d10c98c3>] 0xffffffffc450d69d [<00000000b9299f48>] 0xffffffffc4538392 [<0000000061c39ed6>] dooneinitcall+0xd0/0x4f0 [<00000000b389383b>] doinitmodule+0x1a4/0x680 [<0000000087cf3542>] loadmodule+0x6249/0x7110 [<00000000beba61b8>] dosysfinitmodule+0x140/0x200 [<00000000fdcfff51>] dosyscall64+0x35/0x80 [<000000003c0f1f71>] entrySYSCALL64afterhwframe+0x46/0xb0

That is because q->maops is set to NULL before blkreleasequeue is called.

blkmqinitqueuedata blkmqinitallocatedqueue blkmqreallochwctxs for (i = 0; i < set->nrhwqueues; i++) { oldhctx = xaload(&q->hctxtable, i); if (!blkmqallocandinithctx(.., i, ..)) [1] if (!oldhctx) break;

xaforeachstart(&q->hctxtable, j, hctx, j) blkmqexithctx(q, set, hctx, j); [2]

if (!q->nrhwqueues) [3] goto errhctxs;

errexit: q->mqops = NULL; [4]

blkputqueue blkreleasequeue if (queueismq(q)) [5] blkmqrelease(q);

[1]: blkmqallocandinithctx failed at i != 0. [2]: The hctxs allocated by [1] are moved to q->unusedhctxlist and will be cleaned up in blkmqrelease. [3]: q->nrhwqueues is 0. [4]: Set q->mqops to NULL. [5]: queueismq returns false due to [4]. And blkmqrelease will not be called. The hctxs in q->unusedhctxlist are leaked.

To fix it, call blkreleasequeue in exception path.

Affected Software

5 affected components
Linux Linux kernel
Linux Linux kernel>=5.2<6.0.8
Linux Linux kernel=6.1-rc1
Linux Linux kernel=6.1-rc2
Linux Linux kernel=6.1-rc3

Event History

May 1, 2025
CVE Published
via MITRE·02:10 PM
Data Sourced
via MITRE·02:10 PM
Description
Data Sourced
via NVD·03:16 PM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2022-49901?

CVE-2022-49901 has been classified with a medium severity due to the potential for kernel memory leaks.

2

How do I fix CVE-2022-49901?

To mitigate CVE-2022-49901, update your Linux kernel to the latest stable version that includes the fix.

3

What types of systems are affected by CVE-2022-49901?

CVE-2022-49901 affects systems running vulnerable versions of the Linux kernel that utilize the blk-mq IO scheduler.

4

What is the nature of the vulnerability in CVE-2022-49901?

CVE-2022-49901 involves a memory leak associated with the initialization of a block queue leading to unreferenced memory objects.

5

Is CVE-2022-49901 related to modprobe or any specific module?

Yes, CVE-2022-49901 is triggered during the loading of the null_blk module via modprobe.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203