Skip to contentSkip to conversation

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

PATCH In review David Oostdyk 2 participants 2 messages Mar 8, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rrunner.c: fix possible memory leak in rr_init_one()

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

---
 drivers/net/hippi/rrunner.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/hippi/rrunner.c +3 -0
index d471963..970595a 100644
@@ -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);
Signature · 1 line
1.8.1.5
maintainer
#1 lore raw

From: David Oostdyk <[email protected]>
Date: Fri, 8 Mar 2013 12:23:22 -0500

drivers/net/hippi/rrunner.c static int __devinit rr_init_one(struct pci_dev *pdev, · line 207

Quoted 4 lines

out:

drivers/net/hippi/rrunner.c +3 -0
+	if (rrpriv->evt_ring)
+ pci_free_consistent(pdev, EVT_RING_SIZE, rrpriv->evt_ring,
+				    rrpriv->evt_ring_dma);

Please resend this without the patch being corrupted by your email client.

Read Documentation/email-clients.txt, and use it to correct this.

Send a test patch to yourself, and only after you can successfully apply such a patch sent to your yourself should you resubmit your patch here.

Thanks.