blk-mq: cleanup after blk_mq_init_rq_map failures
authorRobert Elliott <elliott@hp.com>
Tue, 2 Sep 2014 16:38:44 +0000 (11:38 -0500)
committerJens Axboe <axboe@fb.com>
Mon, 30 Mar 2015 18:54:54 +0000 (12:54 -0600)
commit00c6f33d8bc8753c484a22398302d796421dad51
tree93f8b9722868cde73b9550b523052842e8c8f57c
parent2f3a3332a45d413c5246af8996062b21caabe7d3
blk-mq: cleanup after blk_mq_init_rq_map failures

In blk-mq.c blk_mq_alloc_tag_set, if:
set->tags = kmalloc_node()
succeeds, but one of the blk_mq_init_rq_map() calls fails,
goto out_unwind;
needs to free set->tags so the caller is not obligated
to do so.  None of the current callers (null_blk,
virtio_blk, virtio_blk, or the forthcoming scsi-mq)
do so.

set->tags needs to be set to NULL after doing so,
so other tag cleanup logic doesn't try to free
a stale pointer later.  Also set it to NULL
in blk_mq_free_tag_set.

Tested with error injection on the forthcoming
scsi-mq + hpsa combination.

Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq.c