public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 1/2] drivers/misc/cb710/core.c: Add missing pci_dev_put
       [not found] <1311870407-22461-1-git-send-email-julia@diku.dk>
@ 2011-07-28 18:33 ` Michał Mirosław
  2011-07-28 18:55   ` [PATCH] cb710: fix possible pci_dev leak in Michał Mirosław
  0 siblings, 1 reply; 3+ messages in thread
From: Michał Mirosław @ 2011-07-28 18:33 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, linux-kernel

On Thu, Jul 28, 2011 at 06:26:46PM +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
> Pci_get_slot calls pci_dev_get, so pci_dev_put is needed before leaving the
> function.
[...]
> --- a/drivers/misc/cb710/core.c
> +++ b/drivers/misc/cb710/core.c
> @@ -41,7 +41,7 @@ static int __devinit cb710_pci_configure(struct pci_dev *pdev)
>  
>  	pci_read_config_dword(pdev, 0x48, &val);
>  	if (val & 0x80000000)
> -		return 0;
> +		goto out;
>  
>  	if (!pdev0)
>  		return -ENODEV;

The good fix is to use pci_get_slot() before the !pdev0 condition above.
I'll send a patch shortly.

Best Regards,
Micha³ Miros³aw
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH] cb710: fix possible pci_dev leak in
  2011-07-28 18:33 ` [PATCH 1/2] drivers/misc/cb710/core.c: Add missing pci_dev_put Michał Mirosław
@ 2011-07-28 18:55   ` Michał Mirosław
  2011-07-28 22:34     ` [PATCH] cb710: fix possible pci_dev leak in cb710_pci_configure() Chris Ball
  0 siblings, 1 reply; 3+ messages in thread
From: Michał Mirosław @ 2011-07-28 18:55 UTC (permalink / raw)
  To: linux-mmc, Chris Ball; +Cc: kernel-janitors, Julia Lawall

Reported-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/misc/cb710/core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/cb710/core.c b/drivers/misc/cb710/core.c
index efec413..68cd05b 100644
--- a/drivers/misc/cb710/core.c
+++ b/drivers/misc/cb710/core.c
@@ -33,7 +33,7 @@ EXPORT_SYMBOL_GPL(cb710_pci_update_config_reg);
 static int __devinit cb710_pci_configure(struct pci_dev *pdev)
 {
 	unsigned int devfn = PCI_DEVFN(PCI_SLOT(pdev->devfn), 0);
-	struct pci_dev *pdev0 = pci_get_slot(pdev->bus, devfn);
+	struct pci_dev *pdev0;
 	u32 val;
 
 	cb710_pci_update_config_reg(pdev, 0x48,
@@ -43,6 +43,7 @@ static int __devinit cb710_pci_configure(struct pci_dev *pdev)
 	if (val & 0x80000000)
 		return 0;
 
+	pdev0 = pci_get_slot(pdev->bus, devfn);
 	if (!pdev0)
 		return -ENODEV;
 
-- 
1.7.5.4


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

* Re: [PATCH] cb710: fix possible pci_dev leak in cb710_pci_configure()
  2011-07-28 18:55   ` [PATCH] cb710: fix possible pci_dev leak in Michał Mirosław
@ 2011-07-28 22:34     ` Chris Ball
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Ball @ 2011-07-28 22:34 UTC (permalink / raw)
  To: Michał Mirosław; +Cc: linux-mmc, kernel-janitors, Julia Lawall

Hi Michał,

On Thu, Jul 28 2011, Michał Mirosław wrote:
> Reported-by: Julia Lawall <julia@diku.dk>
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
>  drivers/misc/cb710/core.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/misc/cb710/core.c b/drivers/misc/cb710/core.c
> index efec413..68cd05b 100644
> --- a/drivers/misc/cb710/core.c
> +++ b/drivers/misc/cb710/core.c
> @@ -33,7 +33,7 @@ EXPORT_SYMBOL_GPL(cb710_pci_update_config_reg);
>  static int __devinit cb710_pci_configure(struct pci_dev *pdev)
>  {
>  	unsigned int devfn = PCI_DEVFN(PCI_SLOT(pdev->devfn), 0);
> -	struct pci_dev *pdev0 = pci_get_slot(pdev->bus, devfn);
> +	struct pci_dev *pdev0;
>  	u32 val;
>  
>  	cb710_pci_update_config_reg(pdev, 0x48,
> @@ -43,6 +43,7 @@ static int __devinit cb710_pci_configure(struct pci_dev *pdev)
>  	if (val & 0x80000000)
>  		return 0;
>  
> +	pdev0 = pci_get_slot(pdev->bus, devfn);
>  	if (!pdev0)
>  		return -ENODEV;

Pushed to mmc-next for 3.1, thanks.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

end of thread, other threads:[~2011-07-28 22:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1311870407-22461-1-git-send-email-julia@diku.dk>
2011-07-28 18:33 ` [PATCH 1/2] drivers/misc/cb710/core.c: Add missing pci_dev_put Michał Mirosław
2011-07-28 18:55   ` [PATCH] cb710: fix possible pci_dev leak in Michał Mirosław
2011-07-28 22:34     ` [PATCH] cb710: fix possible pci_dev leak in cb710_pci_configure() Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox