]> git.baikalelectronics.ru Git - kernel.git/commit
blk-mq: Unregister debugfs attributes earlier
authorBart Van Assche <bart.vanassche@sandisk.com>
Wed, 26 Apr 2017 20:47:52 +0000 (13:47 -0700)
committerJens Axboe <axboe@fb.com>
Wed, 26 Apr 2017 21:09:04 +0000 (15:09 -0600)
commitfc49e7e162f73e53efc6e55523cf073de50349eb
tree3fe1868219d4506580b19b5738632a6f2baaa041
parent61219df43e8ae84775d8bfd532987b579f1a0c45
blk-mq: Unregister debugfs attributes earlier

We currently call blk_mq_free_queue() from blk_cleanup_queue()
before we unregister the debugfs attributes for that queue in
blk_release_queue(). This leaves a window open during which
accessing most of the mq debugfs attributes would cause a
use-after-free. Additionally, the "state" attribute allows
running the queue, which we should not do after the queue has
entered the "dead" state. Fix both cases by unregistering the
debugfs attributes before freeing queue resources starts.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-core.c