* [PATCH] blk-mq-sched: Don't reference queue tagset in blk_mq_sched_tags_teardown()
@ 2021-10-22 8:12 John Garry
2021-10-22 15:16 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: John Garry @ 2021-10-22 8:12 UTC (permalink / raw)
To: axboe
Cc: ming.lei, linux-block, linux-kernel, naresh.kamboju,
anders.roxell, arnd, John Garry
We should not reference the queue tagset in blk_mq_sched_tags_teardown()
(see function comment) for the blk-mq flags, so use the passed flags
instead.
This solves a use-after-free, similarly fixed earlier (and since broken
again) in commit f0c1c4d2864e ("blk-mq: fix use-after-free in
blk_mq_exit_sched").
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Fixes: e155b0c238b2 ("blk-mq: Use shared tags for shared sbitmap support")
Signed-off-by: John Garry <john.garry@huawei.com>
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index e85b7556b096..6a9444848e3a 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -541,7 +541,7 @@ static void blk_mq_sched_tags_teardown(struct request_queue *q, unsigned int fla
queue_for_each_hw_ctx(q, hctx, i) {
if (hctx->sched_tags) {
- if (!blk_mq_is_shared_tags(q->tag_set->flags))
+ if (!blk_mq_is_shared_tags(flags))
blk_mq_free_rq_map(hctx->sched_tags);
hctx->sched_tags = NULL;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] blk-mq-sched: Don't reference queue tagset in blk_mq_sched_tags_teardown()
2021-10-22 8:12 [PATCH] blk-mq-sched: Don't reference queue tagset in blk_mq_sched_tags_teardown() John Garry
@ 2021-10-22 15:16 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-10-22 15:16 UTC (permalink / raw)
To: John Garry
Cc: ming.lei, anders.roxell, naresh.kamboju, linux-block, arnd, linux-kernel
On Fri, 22 Oct 2021 16:12:20 +0800, John Garry wrote:
> We should not reference the queue tagset in blk_mq_sched_tags_teardown()
> (see function comment) for the blk-mq flags, so use the passed flags
> instead.
>
> This solves a use-after-free, similarly fixed earlier (and since broken
> again) in commit f0c1c4d2864e ("blk-mq: fix use-after-free in
> blk_mq_exit_sched").
>
> [...]
Applied, thanks!
[1/1] blk-mq-sched: Don't reference queue tagset in blk_mq_sched_tags_teardown()
commit: 8bdf7b3fe1f48a2c1c212d4685903bba01409c0e
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-22 15:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22 8:12 [PATCH] blk-mq-sched: Don't reference queue tagset in blk_mq_sched_tags_teardown() John Garry
2021-10-22 15:16 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).