]> Gentwo Git Trees - linux/.git/commit
blk-mq: fix null-ptr-deref in blk_mq_free_tags() from error path
authorYu Kuai <yukuai3@huawei.com>
Tue, 23 Sep 2025 07:01:01 +0000 (15:01 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 23 Sep 2025 07:35:52 +0000 (01:35 -0600)
commit670bfe683850cb29957a9d71f997e9774eb24de6
tree09ea5172b2f505a5e2eae44e1e8c2e2b7c19bdfa
parentfea55691aca1edf2fe612fd75536ec26354a8c4a
blk-mq: fix null-ptr-deref in blk_mq_free_tags() from error path

blk_mq_free_tags() can be called after blk_mq_init_tags(), while
tags->page_list is still not initialized, causing null-ptr-deref.

Fix this problem by initializing tags->page_list at blk_mq_init_tags(),
meanwhile, also free tags directly from error path because there is no
srcu barrier.

Fixes: ad0d05dbddc1 ("blk-mq: Defer freeing of tags page_list to SRCU callback")
Reported-by: syzbot+5c5d41e80248d610221f@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/68d1b079.a70a0220.1b52b.0000.GAE@google.com/
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq-tag.c
block/blk-mq.c