nvme-rdma: fix possible double free condition when failing to create a controller
authorSagi Grimberg <sagi@grimberg.me>
Tue, 19 Jun 2018 12:34:09 +0000 (15:34 +0300)
committerChristoph Hellwig <hch@lst.de>
Wed, 20 Jun 2018 12:20:10 +0000 (14:20 +0200)
commit3d0641015bf73aaa1cb54c936674959e7805070f
tree5ed6d9e3ded85d03728943f2ab4b10269e3493e0
parent9c24c10a2c1e1bb478b6bb70612d9e885aee044f
nvme-rdma: fix possible double free condition when failing to create a controller

Failures after nvme_init_ctrl will defer resource cleanups to .free_ctrl
when the reference is released, hence we should not free the controller
queues for these failures.

Fix that by moving controller queues allocation before controller
initialization and correctly freeing them for failures before
initialization and skip them for failures after initialization.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/rdma.c