Skip to content

Commit

Permalink
dma: intel_mid_dma: fix double free on mid_setup_dma error path
Browse files Browse the repository at this point in the history
We should not call kfree(dma) in mid_setup_dma error path because
the memory is allocated in intel_mid_dma_probe and will be freed
in intel_mid_dma_probe error path if mid_setup_dma return error.

Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
  • Loading branch information
AxelLin authored and djbw committed Dec 3, 2010
1 parent cbeae41 commit 51a1efe
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions drivers/dma/intel_mid_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,6 @@ static int mid_setup_dma(struct pci_dev *pdev)
if (NULL == dma->dma_pool) {
pr_err("ERR_MDMA:pci_pool_create failed\n");
err = -ENOMEM;
kfree(dma);
goto err_dma_pool;
}

Expand Down Expand Up @@ -1186,7 +1185,6 @@ static int mid_setup_dma(struct pci_dev *pdev)
free_irq(pdev->irq, dma);
err_irq:
pci_pool_destroy(dma->dma_pool);
kfree(dma);
err_dma_pool:
pr_err("ERR_MDMA:setup_dma failed: %d\n", err);
return err;
Expand Down

0 comments on commit 51a1efe

Please sign in to comment.