From: Keith Busch Date: Wed, 1 May 2013 19:07:51 +0000 (-0600) Subject: NVMe: Free admin queue on request_irq error X-Git-Tag: firefly_0821_release~3680^2~503^2~11 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=025c557a71bd06a9f6d32259f00e2218b15bf0a4;p=firefly-linux-kernel-4.4.55.git NVMe: Free admin queue on request_irq error Fixes a potential memory leak if requesting the admin queue irq fails. Signed-off-by: Keith Busch Signed-off-by: Matthew Wilcox --- diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 358d17700c20..391a874e4133 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -1054,14 +1054,19 @@ static int nvme_configure_admin_queue(struct nvme_dev *dev) } } - if (result) { - nvme_free_queue_mem(nvmeq); - return result; - } + if (result) + goto free_q; result = queue_request_irq(dev, nvmeq, "nvme admin"); + if (result) + goto free_q; + dev->queues[0] = nvmeq; return result; + + free_q: + nvme_free_queue_mem(nvmeq); + return result; } struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write,