ZeroHour

CVE-2022-49901

CVSS 3.1
5.5 medium
EPSS
<1%p6
Published
()
Modified
Description

In the Linux kernel, the following vulnerability has been resolved: blk-mq: Fix kmemleak in blk_mq_init_allocated_queue There is a kmemleak caused by modprobe null_blk.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: [ ] kmalloc_node_trace+0x22/0x60 [ ] blk_mq_alloc_and_init_hctx+0x289/0x350 [ ] blk_mq_realloc_hw_ctxs+0x2fe/0x3d0 [ ] blk_mq_init_allocated_queue+0x48c/0x1440 [ ] __blk_mq_alloc_disk+0xc8/0x1c0 [ ] 0xffffffffc450d69d [ ] 0xffffffffc4538392 [ ] do_one_initcall+0xd0/0x4f0 [ ] do_init_module+0x1a4/0x680 [ ] load_module+0x6249/0x7110 [ ] __do_sys_finit_module+0x140/0x200 [ ] do_syscall_64+0x35/0x80 [ ] entry_SYSCALL_64_after_hwframe+0x46/0xb0 That is because q->ma_ops is set to NULL before blk_release_queue is called. blk_mq_init_queue_data blk_mq_init_allocated_queue blk_mq_realloc_hw_ctxs for (i = 0; i nr_hw_queues; i++) { old_hctx = xa_load(&q->hctx_table, i); if (!blk_mq_alloc_and_init_hctx(.., i, ..)) [1] if (!old_hctx) break; xa_for_each_start(&q->hctx_table, j, hctx, j) blk_mq_exit_hctx(q, set, hctx, j); [2] if (!q->nr_hw_queues) [3] goto err_hctxs; err_exit: q->mq_ops = NULL; [4] blk_put_queue blk_release_queue if (queue_is_mq(q)) [5] blk_mq_release(q); [1]: blk_mq_alloc_and_init_hctx failed at i != 0. [2]: The hctxs allocated by [1] are moved to q->unused_hctx_list and will be cleaned up in blk_mq_release. [3]: q->nr_hw_queues is 0. [4]: Set q->mq_ops to NULL. [5]: queue_is_mq returns false due to [4]. And blk_mq_release will not be called. The hctxs in q->unused_hctx_list are leaked. To fix it, call blk_release_queue in exception path.

Vendors
linux
Products
linux kernel
Weakness
CWE-401
Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

In the news

No ingested article mentions this CVE yet.