OSDN Git Service

blk-mq: fix race between timeout and CPU hotplug
authorMing Lei <ming.lei@canonical.com>
Tue, 21 Apr 2015 02:00:19 +0000 (10:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 May 2015 16:55:07 +0000 (09:55 -0700)
commitf7bbf3add4e037d8fb5f6251b33dda6a029cbdac
tree151fffccfd235c6c6450e44e36eee0b0e9f7d935
parenta45c1c367c8d8dc4fd5ee6fb5f92454c6145710a
blk-mq: fix race between timeout and CPU hotplug

commit f054b56c951bf1731ba7314a4c7f1cc0b2977cc9 upstream.

Firstly during CPU hotplug, even queue is freezed, timeout
handler still may come and access hctx->tags, which may cause
use after free, so this patch deactivates timeout handler
inside CPU hotplug notifier.

Secondly, tags can be shared by more than one queues, so we
have to check if the hctx has been unmapped, otherwise
still use-after-free on tags can be triggered.

Reported-by: Dongsu Park <dongsu.park@profitbricks.com>
Tested-by: Dongsu Park <dongsu.park@profitbricks.com>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/blk-mq.c