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

Re: [Xen-devel] [PATCH] linux/pcifront: fix freeing of device

To: Jan Beulich <JBeulich@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] linux/pcifront: fix freeing of device
From: Keir Fraser <keir@xxxxxxx>
Date: Mon, 04 Oct 2010 12:46:55 +0100
Cc:
Delivery-date: Mon, 04 Oct 2010 04:47:58 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:user-agent:date :subject:from:to:message-id:thread-topic:thread-index:in-reply-to :mime-version:content-type:content-transfer-encoding; bh=yon9vINh7atyK6ercVnnzFNisIhzATY14jb9EYnCO9o=; b=B4BZ0+Wtny4hEfRzTrEsGwYz684xIVLb2EMklL/KWoRb8+JdmXZRlauK9OKESzK8w7 X7OS/7FZ1yl1a+cPnO5HtlYSmWf7Cfcf1rhU8572AOJKfLPXX7HpxA0bYgVZb+RW1saC 1+TE4sHDJU5SR4JRe+DgKIRGLjpenIFEqBo5w=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:user-agent:date:subject:from:to:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; b=IGuqB0dMLhKg/bv/Dy/nXRZ7ui2thvXsaY6lTfLWhj7FJ5zrv2P5KLOlqm/8pG5kxt i8VVx8qiqCdWCgAvs9dkxF2XFGBrieNILeG+CTULEejVPz3gkhoGjOuQexdUQ49mbtSS U4XwPzELBbeDhoE2j39FHRhdWyr1mHIANDWtQ=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4CA9D1F5020000780001A5AA@xxxxxxxxxxxxxxxxxx>
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: ActjudfAJRSgH7KX/0WEq4PXIKNFIw==
Thread-topic: [Xen-devel] [PATCH] linux/pcifront: fix freeing of device
User-agent: Microsoft-Entourage/12.26.0.100708
Are the two patches you sent out for 2.6.18? If so, you need to make it
clear. There are several Linux trees now and I'm ignoring Linux patches by
default.

 -- Keir

On 04/10/2010 12:09, "Jan Beulich" <JBeulich@xxxxxxxxxx> wrote:

> unbind_from_irqhandler() takes irq, not evtchn, as its first argument.
> 
> Once at it, improve error handling.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
> Reported-by: Rafal Wojtczuk <rafal@xxxxxxxxxxxxxxxxxxxxxx>
> 
> --- a/drivers/xen/pcifront/pcifront.h
> +++ b/drivers/xen/pcifront/pcifront.h
> @@ -30,6 +30,7 @@ struct pcifront_device {
>  
> int evtchn;
> int gnt_ref;
> + int irq;
>  
> /* Lock this when doing any operations in sh_info */
> spinlock_t sh_info_lock;
> --- a/drivers/xen/pcifront/xenbus.c
> +++ b/drivers/xen/pcifront/xenbus.c
> @@ -48,6 +48,7 @@ static struct pcifront_device *alloc_pde
>  
> pdev->evtchn = INVALID_EVTCHN;
> pdev->gnt_ref = INVALID_GRANT_REF;
> + pdev->irq = -1;
>  
> INIT_WORK(&pdev->op_work, pcifront_do_aer, pdev);
>  
> @@ -65,7 +66,9 @@ static void free_pdev(struct pcifront_de
>  
> /*For PCIE_AER error handling job*/
> flush_scheduled_work();
> - unbind_from_irqhandler(pdev->evtchn, pdev);
> +
> + if (pdev->irq > 0)
> +  unbind_from_irqhandler(pdev->irq, pdev);
>  
> if (pdev->evtchn != INVALID_EVTCHN)
> xenbus_free_evtchn(pdev->xdev, pdev->evtchn);
> @@ -73,6 +76,8 @@ static void free_pdev(struct pcifront_de
> if (pdev->gnt_ref != INVALID_GRANT_REF)
> gnttab_end_foreign_access(pdev->gnt_ref,
>  (unsigned long)pdev->sh_info);
> + else
> +  free_page((unsigned long)pdev->sh_info);
>  
> pdev->xdev->dev.driver_data = NULL;
>  
> @@ -94,8 +99,16 @@ static int pcifront_publish_info(struct
> if (err)
> goto out;
>  
> - bind_caller_port_to_irqhandler(pdev->evtchn, pcifront_handler_aer,
> -  SA_SAMPLE_RANDOM, "pcifront", pdev);
> + err = bind_caller_port_to_irqhandler(pdev->evtchn,
> +          pcifront_handler_aer,
> +          SA_SAMPLE_RANDOM,
> +          "pcifront", pdev);
> + if (err < 0) {
> +  xenbus_dev_fatal(pdev->xdev, err,
> +     "Failed to bind event channel");
> +  goto out;
> + }
> + pdev->irq = err;
>  
>        do_publish:
> err = xenbus_transaction_start(&trans);
> @@ -428,6 +441,8 @@ static int pcifront_xenbus_probe(struct
> }
>  
> err = pcifront_publish_info(pdev);
> + if (err)
> +  free_pdev(pdev);
>  
>        out:
> return err;
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



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

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