diff options
author | Ming Lei <ming.lei@canonical.com> | 2015-01-29 07:17:26 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-01-29 11:30:49 -0500 |
commit | 74170118b26e55b611de5210f47657118a03a0e1 (patch) | |
tree | d5dad5639822bf65524659dc7c26a6502a336418 /block/blk-mq.c | |
parent | c59c961ca511dc7ee2f4f7e9c224d16f5c76ca6e (diff) |
Revert "blk-mq: fix hctx/ctx kobject use-after-free"
This reverts commit 76d697d10769048e5721510100bf3a9413a56385.
The commit 76d697d10769048 causes general protection fault
reported from Bart Van Assche:
https://lkml.org/lkml/2015/1/28/334
Reported-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r-- | block/blk-mq.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 9ee3b87c4498..2f95747c287e 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -1641,8 +1641,10 @@ static void blk_mq_free_hw_queues(struct request_queue *q, | |||
1641 | struct blk_mq_hw_ctx *hctx; | 1641 | struct blk_mq_hw_ctx *hctx; |
1642 | unsigned int i; | 1642 | unsigned int i; |
1643 | 1643 | ||
1644 | queue_for_each_hw_ctx(q, hctx, i) | 1644 | queue_for_each_hw_ctx(q, hctx, i) { |
1645 | free_cpumask_var(hctx->cpumask); | 1645 | free_cpumask_var(hctx->cpumask); |
1646 | kfree(hctx); | ||
1647 | } | ||
1646 | } | 1648 | } |
1647 | 1649 | ||
1648 | static int blk_mq_init_hctx(struct request_queue *q, | 1650 | static int blk_mq_init_hctx(struct request_queue *q, |
@@ -2000,9 +2002,11 @@ void blk_mq_free_queue(struct request_queue *q) | |||
2000 | 2002 | ||
2001 | percpu_ref_exit(&q->mq_usage_counter); | 2003 | percpu_ref_exit(&q->mq_usage_counter); |
2002 | 2004 | ||
2005 | free_percpu(q->queue_ctx); | ||
2003 | kfree(q->queue_hw_ctx); | 2006 | kfree(q->queue_hw_ctx); |
2004 | kfree(q->mq_map); | 2007 | kfree(q->mq_map); |
2005 | 2008 | ||
2009 | q->queue_ctx = NULL; | ||
2006 | q->queue_hw_ctx = NULL; | 2010 | q->queue_hw_ctx = NULL; |
2007 | q->mq_map = NULL; | 2011 | q->mq_map = NULL; |
2008 | 2012 | ||