In function blk_mq_realloc_tag_set_tags, there is a check on set->tags,
but kfree should only be called when set->tags isn't null
Signed-off-by: Liu Wei <[email protected]>
---
block/blk-mq.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index ac18f802c027..07a3fc01d54b 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -4409,10 +4409,11 @@ static int blk_mq_realloc_tag_set_tags(struct blk_mq_tag_set *set,
if (!new_tags)
return -ENOMEM;
- if (set->tags)
+ if (set->tags) {
memcpy(new_tags, set->tags, set->nr_hw_queues *
sizeof(*set->tags));
- kfree(set->tags);
+ kfree(set->tags);
+ }
set->tags = new_tags;
for (i = set->nr_hw_queues; i < new_nr_hw_queues; i++) {
--
2.42.1