netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tg3: fix error handling in tg3_open
@ 2011-11-03 10:36 Akinobu Mita
  2011-11-03 19:19 ` Matt Carlson
  0 siblings, 1 reply; 3+ messages in thread
From: Akinobu Mita @ 2011-11-03 10:36 UTC (permalink / raw)
  To: netdev; +Cc: Akinobu Mita, David S. Miller, Matt Carlson, Michael Chan

If one of the request_irq calls fails in tg3_open, all interrupts
allocated with request_irq should be freed before returning error.

But it accidentally attempts to free the same invalid IRQ repeatedly.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Matt Carlson <mcarlson@broadcom.com>
Cc: Michael Chan <mchan@broadcom.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 drivers/net/ethernet/broadcom/tg3.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 161cbbb..13c4054 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -9674,8 +9674,10 @@ static int tg3_open(struct net_device *dev)
 		struct tg3_napi *tnapi = &tp->napi[i];
 		err = tg3_request_irq(tp, i);
 		if (err) {
-			for (i--; i >= 0; i--)
+			for (i--; i >= 0; i--) {
+				tnapi = &tp->napi[i];
 				free_irq(tnapi->irq_vec, tnapi);
+			}
 			break;
 		}
 	}
-- 
1.7.4.4

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

* Re: [PATCH] tg3: fix error handling in tg3_open
  2011-11-03 10:36 [PATCH] tg3: fix error handling in tg3_open Akinobu Mita
@ 2011-11-03 19:19 ` Matt Carlson
  2011-11-03 21:23   ` Akinobu Mita
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Carlson @ 2011-11-03 19:19 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: netdev, David S. Miller, Matthew Carlson, Michael Chan

On Thu, Nov 03, 2011 at 03:36:43AM -0700, Akinobu Mita wrote:
> If one of the request_irq calls fails in tg3_open, all interrupts
> allocated with request_irq should be freed before returning error.
> 
> But it accidentally attempts to free the same invalid IRQ repeatedly.

Hi Akinobu.  I have a similar patch under internal review at this very
minute.  The patch I have does a minor additional cleanup.  (It moves
the 'goto err_out2' inside the 'if (err)' block.)  Is it O.K.
with you to add your SOB to my patch instead?

> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Matt Carlson <mcarlson@broadcom.com>
> Cc: Michael Chan <mchan@broadcom.com>
> Cc: netdev@vger.kernel.org
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> ---
>  drivers/net/ethernet/broadcom/tg3.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index 161cbbb..13c4054 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -9674,8 +9674,10 @@ static int tg3_open(struct net_device *dev)
>  		struct tg3_napi *tnapi = &tp->napi[i];
>  		err = tg3_request_irq(tp, i);
>  		if (err) {
> -			for (i--; i >= 0; i--)
> +			for (i--; i >= 0; i--) {
> +				tnapi = &tp->napi[i];
>  				free_irq(tnapi->irq_vec, tnapi);
> +			}
>  			break;
>  		}
>  	}
> -- 
> 1.7.4.4
> 
> 

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

* Re: [PATCH] tg3: fix error handling in tg3_open
  2011-11-03 19:19 ` Matt Carlson
@ 2011-11-03 21:23   ` Akinobu Mita
  0 siblings, 0 replies; 3+ messages in thread
From: Akinobu Mita @ 2011-11-03 21:23 UTC (permalink / raw)
  To: Matt Carlson; +Cc: netdev, David S. Miller, Michael Chan

2011/11/4 Matt Carlson <mcarlson@broadcom.com>:
> On Thu, Nov 03, 2011 at 03:36:43AM -0700, Akinobu Mita wrote:
>> If one of the request_irq calls fails in tg3_open, all interrupts
>> allocated with request_irq should be freed before returning error.
>>
>> But it accidentally attempts to free the same invalid IRQ repeatedly.
>
> Hi Akinobu.  I have a similar patch under internal review at this very
> minute.  The patch I have does a minor additional cleanup.  (It moves
> the 'goto err_out2' inside the 'if (err)' block.)  Is it O.K.
> with you to add your SOB to my patch instead?

Sounds good.  Could you send the patch after finishing your review?

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

end of thread, other threads:[~2011-11-03 21:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-03 10:36 [PATCH] tg3: fix error handling in tg3_open Akinobu Mita
2011-11-03 19:19 ` Matt Carlson
2011-11-03 21:23   ` Akinobu Mita

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).