From: Laibin Qiu
maillist inclusion
category: bugfix
issue: #I4NRS5
CVE: NA
Signed-off-by: Yu Changchun
---------------------------
If the blk_mq_sched_alloc_tags() -> blk_mq_alloc_rqs() call fails,
then we call blk_mq_free_rq_map(). But if BLK_MQ_F_TAG_HCTX_SHARED
has been set to hctx->flags, tags->bitmap_tags and
tags->breserved_tags will not be released and cause a memory leak.
Fixes: 31044c2e5b8de ("blk-mq-sched: Fix blk_mq_sched_alloc_tags() error
handling")
Signed-off-by: Laibin Qiu
Reviewed-by: Jason Yan
Signed-off-by: Chen Jun
Signed-off-by: Zheng Zengkai
Signed-off-by: Yu Changchun
---
block/blk-mq-sched.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index 3fea30f0ea27..a3266541bd06 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -522,7 +522,7 @@ static int blk_mq_sched_alloc_tags(struct request_queue *q,
ret = blk_mq_alloc_rqs(set, hctx->sched_tags, hctx_idx, q->nr_requests);
if (ret) {
- blk_mq_free_rq_map(hctx->sched_tags, set->flags);
+ blk_mq_free_rq_map(hctx->sched_tags, flags);
hctx->sched_tags = NULL;
}
--
2.25.1