All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rrunner.c: fix possible memory leak in rr_init_one()
@ 2013-03-08 18:28 daveo
  2013-03-10 20:43 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: daveo @ 2013-03-08 18:28 UTC (permalink / raw)
  To: netdev; +Cc: jes, David Oostdyk

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(+)

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);
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] rrunner.c: fix possible memory leak in rr_init_one()
  2013-03-08 18:28 [PATCH] rrunner.c: fix possible memory leak in rr_init_one() daveo
@ 2013-03-10 20:43 ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-03-10 20:43 UTC (permalink / raw)
  To: daveo; +Cc: netdev, jes

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rrunner.c: fix possible memory leak in rr_init_one()
  2013-03-08 17:23 David Oostdyk
@ 2013-03-08 17:32 ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-03-08 17:32 UTC (permalink / raw)
  To: daveo; +Cc: netdev, jes

From: David Oostdyk <daveo@ll.mit.edu>
Date: Fri, 8 Mar 2013 12:23:22 -0500

>    out:
> +	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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] rrunner.c: fix possible memory leak in rr_init_one()
@ 2013-03-08 17:23 David Oostdyk
  2013-03-08 17:32 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: David Oostdyk @ 2013-03-08 17:23 UTC (permalink / raw)
  To: netdev; +Cc: jes, daveo

[-- Attachment #1: Type: text/plain, Size: 770 bytes --]

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(+)

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);
-- 
1.8.1.5



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4567 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-10 20:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-08 18:28 [PATCH] rrunner.c: fix possible memory leak in rr_init_one() daveo
2013-03-10 20:43 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2013-03-08 17:23 David Oostdyk
2013-03-08 17:32 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.