Patchwork rrunner.c: fix possible memory leak in rr_init_one()

login
register
mail settings
Submitter David Oostdyk
Date March 8, 2013, 6:28 p.m.
Message ID <1362767295-16334-1-git-send-email-daveo@ll.mit.edu>
Download mbox | patch
Permalink /patch/226184/
State Accepted
Delegated to: David Miller
Headers show

Comments

David Oostdyk - March 8, 2013, 6:28 p.m.
From: David Oostdyk <daveo@ll.mit.edu>

In the event that register_netdev() failed, the rrpriv->evt_ring
allocation would have not been freed.

Signed-off-by: David Oostdyk <daveo@ll.mit.edu>
---
 drivers/net/hippi/rrunner.c | 3 +++
 1 file changed, 3 insertions(+)
David Miller - March 10, 2013, 8:43 p.m.
From: <daveo@ll.mit.edu>
Date: Fri, 8 Mar 2013 13:28:15 -0500

> From: David Oostdyk <daveo@ll.mit.edu>
> 
> In the event that register_netdev() failed, the rrpriv->evt_ring
> allocation would have not been freed.
> 
> Signed-off-by: David Oostdyk <daveo@ll.mit.edu>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c
index d471963..970595a 100644
--- a/drivers/net/hippi/rrunner.c
+++ b/drivers/net/hippi/rrunner.c
@@ -203,6 +203,9 @@  static int __devinit rr_init_one(struct pci_dev *pdev,
 	return 0;
 
  out:
+	if (rrpriv->evt_ring)
+		pci_free_consistent(pdev, EVT_RING_SIZE, rrpriv->evt_ring,
+				    rrpriv->evt_ring_dma);
 	if (rrpriv->rx_ring)
 		pci_free_consistent(pdev, RX_TOTAL_SIZE, rrpriv->rx_ring,
 				    rrpriv->rx_ring_dma);