Skip to content

Commit

Permalink
NVMe: Fix memory leak in nvme_dev_add()
Browse files Browse the repository at this point in the history
The driver was allocating 8k of memory, then freeing 4k of it.

Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
  • Loading branch information
Matthew Wilcox committed Nov 4, 2011
1 parent d1a490e commit 684f5c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/block/nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ static int __devinit nvme_dev_add(struct nvme_dev *dev)
list_for_each_entry(ns, &dev->namespaces, list)
add_disk(ns->disk);

dma_free_coherent(&dev->pci_dev->dev, 4096, id, dma_addr);
dma_free_coherent(&dev->pci_dev->dev, 8192, id, dma_addr);
return 0;

out_free:
Expand All @@ -1466,7 +1466,7 @@ static int __devinit nvme_dev_add(struct nvme_dev *dev)
nvme_ns_free(ns);
}

dma_free_coherent(&dev->pci_dev->dev, 4096, id, dma_addr);
dma_free_coherent(&dev->pci_dev->dev, 8192, mem, dma_addr);
return res;
}

Expand Down

0 comments on commit 684f5c2

Please sign in to comment.