All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Possible AMD8111e free irq issue
@ 2005-02-28 13:07 Panagiotis Issaris
  2005-03-02  6:22 ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Panagiotis Issaris @ 2005-02-28 13:07 UTC (permalink / raw)
  To: linux-kernel

Hi,

It seems to me that if in the amd8111e_open() fuction dev->irq isn't
zero and the irq request succeeds it might not get released anymore.

Specifically, on failure of the amd8111e_restart() call the function
returns -ENOMEM without releasing the irq. The amd8111e_restart()
function can fail because of various pci_alloc_consistent() and
dev_alloc_skb() calls in amd8111e_init_ring() which is being
called by amd8111e_restart.

1374     if(dev->irq ==0 || request_irq(dev->irq, amd8111e_interrupt, SA_SHIRQ,
1375                      dev->name, dev))
1376         return -EAGAIN;
	
The patch applies to 2.6.11-rc5-bk2. 

If I'm right about the above, I'm not I'm not sure if the free_irq() should
happen before or after releasing the spinlock.

With friendly regards,
Takis

diff -uprN linux-2.6.11-rc5-bk2/drivers/net/amd8111e.c linux-2.6.11-rc5-bk2-pi/drivers/net/amd8111e.c
--- linux-2.6.11-rc5-bk2/drivers/net/amd8111e.c	2005-02-28 13:44:46.000000000 +0100
+++ linux-2.6.11-rc5-bk2-pi/drivers/net/amd8111e.c	2005-02-28 13:45:09.000000000 +0100
@@ -1381,6 +1381,8 @@ static int amd8111e_open(struct net_devi
 
 	if(amd8111e_restart(dev)){
 		spin_unlock_irq(&lp->lock);
+		if (dev->irq)
+			free_irq(dev->irq, dev);
 		return -ENOMEM;
 	}
 	/* Start ipg timer */


-- 
OpenPGP key: http://lumumba.luc.ac.be/takis/takis_public_key.txt
fingerprint: 6571 13A3 33D9 3726 F728  AA98 F643 B12E ECF3 E029

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

* Re: [PATCH] Possible AMD8111e free irq issue
  2005-02-28 13:07 [PATCH] Possible AMD8111e free irq issue Panagiotis Issaris
@ 2005-03-02  6:22 ` Jeff Garzik
  2005-03-02  7:57   ` Panagiotis Issaris
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2005-03-02  6:22 UTC (permalink / raw)
  To: panagiotis.issaris; +Cc: linux-kernel

Panagiotis Issaris wrote:
> Hi,
> 
> It seems to me that if in the amd8111e_open() fuction dev->irq isn't
> zero and the irq request succeeds it might not get released anymore.
> 
> Specifically, on failure of the amd8111e_restart() call the function
> returns -ENOMEM without releasing the irq. The amd8111e_restart()
> function can fail because of various pci_alloc_consistent() and
> dev_alloc_skb() calls in amd8111e_init_ring() which is being
> called by amd8111e_restart.
> 
> 1374     if(dev->irq ==0 || request_irq(dev->irq, amd8111e_interrupt, SA_SHIRQ,
> 1375                      dev->name, dev))
> 1376         return -EAGAIN;
> 	
> The patch applies to 2.6.11-rc5-bk2. 
> 
> If I'm right about the above, I'm not I'm not sure if the free_irq() should
> happen before or after releasing the spinlock.
> 
> With friendly regards,
> Takis
> 
> diff -uprN linux-2.6.11-rc5-bk2/drivers/net/amd8111e.c linux-2.6.11-rc5-bk2-pi/drivers/net/amd8111e.c
> --- linux-2.6.11-rc5-bk2/drivers/net/amd8111e.c	2005-02-28 13:44:46.000000000 +0100
> +++ linux-2.6.11-rc5-bk2-pi/drivers/net/amd8111e.c	2005-02-28 13:45:09.000000000 +0100
> @@ -1381,6 +1381,8 @@ static int amd8111e_open(struct net_devi
>  
>  	if(amd8111e_restart(dev)){
>  		spin_unlock_irq(&lp->lock);
> +		if (dev->irq)
> +			free_irq(dev->irq, dev);
>  		return -ENOMEM;

Yes, this is a needed fix.  Thanks.

	Jeff




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

* Re: [PATCH] Possible AMD8111e free irq issue
  2005-03-02  6:22 ` Jeff Garzik
@ 2005-03-02  7:57   ` Panagiotis Issaris
  0 siblings, 0 replies; 3+ messages in thread
From: Panagiotis Issaris @ 2005-03-02  7:57 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-kernel

Hi,

Jeff Garzik wrote:

>> diff -uprN linux-2.6.11-rc5-bk2/drivers/net/amd8111e.c 
>> linux-2.6.11-rc5-bk2-pi/drivers/net/amd8111e.c
>> --- linux-2.6.11-rc5-bk2/drivers/net/amd8111e.c    2005-02-28 
>> 13:44:46.000000000 +0100
>> +++ linux-2.6.11-rc5-bk2-pi/drivers/net/amd8111e.c    2005-02-28 
>> 13:45:09.000000000 +0100
>> @@ -1381,6 +1381,8 @@ static int amd8111e_open(struct net_devi
>>  
>>      if(amd8111e_restart(dev)){
>>          spin_unlock_irq(&lp->lock);
>> +        if (dev->irq)
>> +            free_irq(dev->irq, dev);
>>          return -ENOMEM;
>
>
> Yes, this is a needed fix.  Thanks.

Should the release of the irq happen before or after unlocking the 
spinlock? I wasn't really
sure about it.

With friendly regards,
Takis

-- 
  K.U.Leuven, Mechanical Eng.,  Mechatronics & Robotics Research Group
  http://people.mech.kuleuven.ac.be/~pissaris/


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

end of thread, other threads:[~2005-03-02  7:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-28 13:07 [PATCH] Possible AMD8111e free irq issue Panagiotis Issaris
2005-03-02  6:22 ` Jeff Garzik
2005-03-02  7:57   ` Panagiotis Issaris

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.