summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorDan Carpenter2018-11-29 11:56:54 +0100
committerJens Axboe2018-11-29 16:16:08 +0100
commit4e6db0f21c99c25980c8d183f95cdb6ad64cebd2 (patch)
tree97f2715ddaa0a87b7b79667856f0a05fc480efc0 /block
parentataflop: fix error handling in atari_floppy_init() (diff)
downloadkernel-qcow2-linux-4e6db0f21c99c25980c8d183f95cdb6ad64cebd2.tar.gz
kernel-qcow2-linux-4e6db0f21c99c25980c8d183f95cdb6ad64cebd2.tar.xz
kernel-qcow2-linux-4e6db0f21c99c25980c8d183f95cdb6ad64cebd2.zip
blk-mq: Add a NULL check in blk_mq_free_map_and_requests()
I recently found some code which called blk_mq_free_map_and_requests() with a NULL set->tags pointer. I fixed the caller, but it seems like a good idea to add a NULL check here as well. Now we can call: blk_mq_free_tag_set(set); blk_mq_free_tag_set(set); twice in a row and it's harmless. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/blk-mq.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index a82830f39933..5f4b93f424b4 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2341,7 +2341,7 @@ static bool __blk_mq_alloc_rq_map(struct blk_mq_tag_set *set, int hctx_idx)
static void blk_mq_free_map_and_requests(struct blk_mq_tag_set *set,
unsigned int hctx_idx)
{
- if (set->tags[hctx_idx]) {
+ if (set->tags && set->tags[hctx_idx]) {
blk_mq_free_rqs(set, set->tags[hctx_idx], hctx_idx);
blk_mq_free_rq_map(set->tags[hctx_idx]);
set->tags[hctx_idx] = NULL;