tg3: fix error handling in tg3_open
Subsystems (3)
PATCH 1/1 tg3: fix error handling in tg3_open
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.
--- drivers/net/ethernet/broadcom/tg3.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +3 -1
@@ -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 ; } }
Signature · 1 line
1.7.4.4
Quoted 4 lines · Akinobu Mita
If one of the
request_irqcalls fails intg3_open, all interrupts allocated withrequest_irqshould 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?
Quoted 29 lines
Cc "David S. Miller" <[email protected]>Cc Matt Carlson <[email protected]>Cc Michael Chan <[email protected]>Signed-off-by Akinobu Mita <[email protected]>--- drivers/net/ethernet/broadcom/tg3.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)drivers/net/ethernet/broadcom/tg3.c +3
-1@@ -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 ; } }Signature · 1 line
1.7.4.4
2011/11/4 Matt Carlson <[email protected]>:
Quoted 10 lines · Akinobu Mita
Quoted 4 lines
If one of the
request_irqcalls fails intg3_open, all interrupts allocated withrequest_irqshould 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?