linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] pcmcia: Add missing free_irq()
@ 2015-06-14 12:14 Takeshi Yoshimura
  2015-06-14 14:28 ` Dominik Brodowski
  0 siblings, 1 reply; 3+ messages in thread
From: Takeshi Yoshimura @ 2015-06-14 12:14 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Vaishali Thakkar, linux-pcmcia
  Cc: linux-kernel, Takeshi Yoshimura

In yenta_probe(), an irq leak potentially happens when
pcmcia_register_socket() fails. I added the missed call.

Signed-off-by: Takeshi Yoshimura <yos@sslab.ics.keio.ac.jp>
---
 drivers/pcmcia/yenta_socket.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 965bd84..7922e30f 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -1269,6 +1269,8 @@ static int yenta_probe(struct pci_dev *dev, const struct pci_device_id *id)
 		pcmcia_unregister_socket(&socket->socket);
 	}
 
+	if (socket->cb_irq)
+		free_irq(socket->irq, socket);
  unmap:
 	iounmap(socket->base);
  release:
-- 
1.9.1


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

* Re: [PATCH 1/1] pcmcia: Add missing free_irq()
  2015-06-14 12:14 [PATCH 1/1] pcmcia: Add missing free_irq() Takeshi Yoshimura
@ 2015-06-14 14:28 ` Dominik Brodowski
  2015-06-14 17:21   ` Takeshi Yoshimura
  0 siblings, 1 reply; 3+ messages in thread
From: Dominik Brodowski @ 2015-06-14 14:28 UTC (permalink / raw)
  To: Takeshi Yoshimura
  Cc: Greg Kroah-Hartman, Vaishali Thakkar, linux-pcmcia, linux-kernel

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

Hi Takeshi,

On Sun, Jun 14, 2015 at 09:14:41PM +0900, Takeshi Yoshimura wrote:
> In yenta_probe(), an irq leak potentially happens when
> pcmcia_register_socket() fails. I added the missed call.

nice catch, many thanks.

> index 965bd84..7922e30f 100644
> --- a/drivers/pcmcia/yenta_socket.c
> +++ b/drivers/pcmcia/yenta_socket.c
> @@ -1269,6 +1269,8 @@ static int yenta_probe(struct pci_dev *dev, const struct pci_device_id *id)
>  		pcmcia_unregister_socket(&socket->socket);
>  	}
>  
> +	if (socket->cb_irq)
> +		free_irq(socket->irq, socket);
>   unmap:
>  	iounmap(socket->base);
>   release:


However, this should also handle the case for sock->cb_irq being zero,
like it is done in yenta_close.

Furthermore, when comparing yenta_close and this error path in yenta_probe(),
I noticed a few other issues:
- yenta_free_resources() is not called in yenta_probe()
- pci_set_drvdata(dev, NULL) and kfree(socket) are not called in yenta_probe()
- sock->base is always set to non-NULL when yenta_close() is called,
  therefore the check in yenta_close() may be removed.

Would you be willing to update your patch to address also these issues?
Then, I'll happily push it upstream.

Best,
	Dominik

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 1/1] pcmcia: Add missing free_irq()
  2015-06-14 14:28 ` Dominik Brodowski
@ 2015-06-14 17:21   ` Takeshi Yoshimura
  0 siblings, 0 replies; 3+ messages in thread
From: Takeshi Yoshimura @ 2015-06-14 17:21 UTC (permalink / raw)
  To: Dominik Brodowski
  Cc: Greg Kroah-Hartman, Vaishali Thakkar, linux-pcmcia, linux-kernel

Hi,

>> index 965bd84..7922e30f 100644
>> --- a/drivers/pcmcia/yenta_socket.c
>> +++ b/drivers/pcmcia/yenta_socket.c
>> @@ -1269,6 +1269,8 @@ static int yenta_probe(struct pci_dev *dev, const struct pci_device_id *id)
>>               pcmcia_unregister_socket(&socket->socket);
>>       }
>>
>> +     if (socket->cb_irq)
>> +             free_irq(socket->irq, socket);
>>   unmap:
>>       iounmap(socket->base);
>>   release:

Oops, I noticed the fixed code was not compilable. Sorry for that.

>
> However, this should also handle the case for sock->cb_irq being zero,
> like it is done in yenta_close.
>
> Furthermore, when comparing yenta_close and this error path in yenta_probe(),
> I noticed a few other issues:
> - yenta_free_resources() is not called in yenta_probe()
> - pci_set_drvdata(dev, NULL) and kfree(socket) are not called in yenta_probe()
> - sock->base is always set to non-NULL when yenta_close() is called,
>   therefore the check in yenta_close() may be removed.
>

Thanks for many suggestions. But, it looks like yenta_probe() called kfree()
appropriately. I guess you meant to kfree() is not called in yenta_close().

> Would you be willing to update your patch to address also these issues?
> Then, I'll happily push it upstream.
>

Sure. I'll send the updated patch in another mail.


Regards,
Takeshi Yoshimura

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

end of thread, other threads:[~2015-06-14 17:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-14 12:14 [PATCH 1/1] pcmcia: Add missing free_irq() Takeshi Yoshimura
2015-06-14 14:28 ` Dominik Brodowski
2015-06-14 17:21   ` Takeshi Yoshimura

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).