diff options
author | Keith Busch <keith.busch@intel.com> | 2013-05-01 13:07:51 -0600 |
---|---|---|
committer | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2013-05-02 14:33:53 -0400 |
commit | 025c557a71bd06a9f6d32259f00e2218b15bf0a4 (patch) | |
tree | 06ed292f4b314481699535164b5066a74a5f7511 /drivers/block/nvme-core.c | |
parent | ec5037335064dcc52c2fbbf3d505bae0eb27e713 (diff) | |
download | lwn-025c557a71bd06a9f6d32259f00e2218b15bf0a4.tar.gz lwn-025c557a71bd06a9f6d32259f00e2218b15bf0a4.zip |
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 <keith.busch@intel.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'drivers/block/nvme-core.c')
-rw-r--r-- | drivers/block/nvme-core.c | 13 |
1 files changed, 9 insertions, 4 deletions
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, |