* [PATCH 1/1] PCI: xen-pcifront, fix PCI reference leak
@ 2010-11-04 14:31 Jiri Slaby
2010-11-04 18:27 ` Milton Miller
0 siblings, 1 reply; 4+ messages in thread
From: Jiri Slaby @ 2010-11-04 14:31 UTC (permalink / raw)
To: jbarnes
Cc: linux-pci, xen-devel, linux-kernel, jirislaby,
Konrad Rzeszutek Wilk
Stanse found that when pdev is found and has no driver a reference is
leaked in pcifront_common_process. So add pci_dev_put there. For the
pdev == NULL case, pci_dev_put(NULL) is fine.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
---
drivers/pci/xen-pcifront.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index a87c498..f9ffc05 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -578,6 +578,7 @@ static pci_ers_result_t pcifront_common_process(int cmd,
if (!pcidev || !pcidev->driver) {
dev_err(&pcidev->dev,
"device or driver is NULL\n");
+ pci_dev_put(pcidev);
return result;
}
pdrv = pcidev->driver;
--
1.7.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 1/1] PCI: xen-pcifront, fix PCI reference leak
2010-11-04 14:31 [PATCH 1/1] PCI: xen-pcifront, fix PCI reference leak Jiri Slaby
@ 2010-11-04 18:27 ` Milton Miller
2010-11-08 16:34 ` Konrad Rzeszutek Wilk
0 siblings, 1 reply; 4+ messages in thread
From: Milton Miller @ 2010-11-04 18:27 UTC (permalink / raw)
To: Jiri Slaby
Cc: jbarnes, linux-pci, xen-devel, linux-kernel, jirislaby,
Konrad Rzeszutek Wilk
On 2010-11-04 at about 14:31:30 Jiri Slaby wrote:
> Stanse found that when pdev is found and has no driver a reference is
> leaked in pcifront_common_process. So add pci_dev_put there. For the
> pdev == NULL case, pci_dev_put(NULL) is fine.
While that may be true, the dev_err(&pcidev->dev ... is a NULL pointer
deref.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
> drivers/pci/xen-pcifront.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> index a87c498..f9ffc05 100644
> --- a/drivers/pci/xen-pcifront.c
> +++ b/drivers/pci/xen-pcifront.c
> @@ -578,6 +578,7 @@ static pci_ers_result_t pcifront_common_process(int cmd,
> if (!pcidev || !pcidev->driver) {
> dev_err(&pcidev->dev,
> "device or driver is NULL\n");
> + pci_dev_put(pcidev);
> return result;
> }
> pdrv = pcidev->driver;
>
milton
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 1/1] PCI: xen-pcifront, fix PCI reference leak
2010-11-04 18:27 ` Milton Miller
@ 2010-11-08 16:34 ` Konrad Rzeszutek Wilk
2010-11-09 10:27 ` Jiri Slaby
0 siblings, 1 reply; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2010-11-08 16:34 UTC (permalink / raw)
To: Milton Miller
Cc: Jiri Slaby, jbarnes, linux-pci, xen-devel, linux-kernel,
jirislaby
On Thu, Nov 04, 2010 at 12:27:07PM -0600, Milton Miller wrote:
> On 2010-11-04 at about 14:31:30 Jiri Slaby wrote:
> > Stanse found that when pdev is found and has no driver a reference is
> > leaked in pcifront_common_process. So add pci_dev_put there. For the
> > pdev == NULL case, pci_dev_put(NULL) is fine.
>
> While that may be true, the dev_err(&pcidev->dev ... is a NULL pointer
> deref.
I've put the fix in the branch (stable/xen-pcifront-fixes) that I will ask Linus
to pull.. but what options did you need to find this?
I tried to run this before putting your and Milton fix in:
konrad@phenom:~/tar/stanse-1.1.2$ java -jar ./stanse.jar ~/work/linux/drivers/pci/xen-pcifront.c
Stanse version "1.1.2"
Copyright (c) 2008-2010 Masaryk University, Brno
STANSE_HOME not specified. Using the location of stanse.jar.
Checking for bugs:
<-> File: /home/konrad/work/linux/drivers/pci/xen-pcifront.c
<-> --------------------------------
Done.
And no warnings?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] PCI: xen-pcifront, fix PCI reference leak
2010-11-08 16:34 ` Konrad Rzeszutek Wilk
@ 2010-11-09 10:27 ` Jiri Slaby
0 siblings, 0 replies; 4+ messages in thread
From: Jiri Slaby @ 2010-11-09 10:27 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk
Cc: Milton Miller, jbarnes, linux-pci, xen-devel, linux-kernel
On 11/08/2010 05:34 PM, Konrad Rzeszutek Wilk wrote:
> On Thu, Nov 04, 2010 at 12:27:07PM -0600, Milton Miller wrote:
>> On 2010-11-04 at about 14:31:30 Jiri Slaby wrote:
>>> Stanse found that when pdev is found and has no driver a reference is
>>> leaked in pcifront_common_process. So add pci_dev_put there. For the
>>> pdev == NULL case, pci_dev_put(NULL) is fine.
>>
>> While that may be true, the dev_err(&pcidev->dev ... is a NULL pointer
>> deref.
>
> I've put the fix in the branch (stable/xen-pcifront-fixes) that I will ask Linus
> to pull.. but what options did you need to find this?
>
> I tried to run this before putting your and Milton fix in:
> konrad@phenom:~/tar/stanse-1.1.2$ java -jar ./stanse.jar ~/work/linux/drivers/pci/xen-pcifront.c
> Stanse version "1.1.2"
> Copyright (c) 2008-2010 Masaryk University, Brno
>
> STANSE_HOME not specified. Using the location of stanse.jar.
> Checking for bugs:
> <-> File: /home/konrad/work/linux/drivers/pci/xen-pcifront.c
> <-> --------------------------------
> Done.
>
> And no warnings?
It's not easy as that. You have to specify checkers like
-c
AutomatonChecker:dist/data/checkers/AutomatonChecker/kernel_pairing.xml
-c AutomatonChecker:dist/data/checkers/AutomatonChecker/kernel_memory.xml
etc. Then, probably stanse won't guess kernel build flags correctly, so
you need to utilize kernel make system. So the command-line (from linux
src dir) would be:
STANSE_HOME=PATH java -jar PATH/stanse.jar -c
AutomatonChecker:PATH/dist/data/checkers/AutomatonChecker/kernel_pairing.xml
-c
AutomatonChecker:PATH/dist/data/checkers/AutomatonChecker/kernel_memory.xml
--makefile Makefile --make-params 'drivers/pci/xen-pcifront.o'
Presumably drivers/pci/xen-pcifront.o must not exist so that when stanse
runs make, it actually builds something. It will warn you about that anyway.
Maybe you want to run with gui: -g to track the issues in gui. There you
can also add the checkers by hand (or on cmdline too).
For openSUSE, I package stanse into rpm, and there is a script which has
-k and adds all the kernel checkers by default.
regards,
--
js
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-11-09 10:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-04 14:31 [PATCH 1/1] PCI: xen-pcifront, fix PCI reference leak Jiri Slaby
2010-11-04 18:27 ` Milton Miller
2010-11-08 16:34 ` Konrad Rzeszutek Wilk
2010-11-09 10:27 ` Jiri Slaby
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox