WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH 1/1] PCI: xen-pcifront, fix PCI reference leak

To: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH 1/1] PCI: xen-pcifront, fix PCI reference leak
From: Jiri Slaby <jirislaby@xxxxxxxxx>
Date: Tue, 09 Nov 2010 11:27:49 +0100
Cc: linux-pci@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, jbarnes@xxxxxxxxxxxxxxxx, Milton Miller <miltonm@xxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx
Delivery-date: Wed, 10 Nov 2010 09:58:38 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=2yPD6vULxOSkstACukTcIX//qiETHCDXPWUNvD3JAlI=; b=NSXI4rPZC2t09i5tDgyCBNPYTU9qwim097/P9VU6qhUlkV3oEqVPeraTFSs21lNw/Q rtQgtHlPxfn6UHfHwvXDxzPyo/nA07qXGAtEQdCX814fMvnXu+RNl4vc/tfQYFgrHBls g83oac/aISqEWCVprNE33bpn0TYneu92MEBk8=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=Sv+Vk2yHQ8ew5aU3+FUgyHCtfooQwvHSuupFSBjqBH/A9sQIS8YSX3FynNmhIXo3sA eE2hK/ntIjU/PqnQ/PYKP5IAs9OHqW6nGhYaZZGNK5m91jMdbGVGPphadK/sJg504CRr D7QdESzMjO2qsONLV6mPTLqDuQsLGUVZYmwkk=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20101108163411.GA2638@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1288881090-27335-1-git-send-email-jslaby@xxxxxxx> <xenfront-reffix-fixreq@xxxxxxxxxxx> <20101108163411.GA2638@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; cs-CZ; rv:1.9.2.12) Gecko/20101026 SUSE/3.1.6 Thunderbird/3.1.6
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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>