From: kaf24@scramble.cl.cam.ac.uk Date: Fri, 23 Apr 2004 12:48:48 +0000 (+0000) Subject: bitkeeper revision 1.876 (408910b0l_pMz-kCs2Q02jsIzb-VLw) X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~18245 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=aeb5221d0b873180fd4d89bfdc26ff90b170892c;p=xen.git bitkeeper revision 1.876 (408910b0l_pMz-kCs2Q02jsIzb-VLw) Fix refcnt bug. --- diff --git a/xen/common/physdev.c b/xen/common/physdev.c index 37ed7c74e3..0d14a31527 100644 --- a/xen/common/physdev.c +++ b/xen/common/physdev.c @@ -125,6 +125,7 @@ int physdev_pci_access_modify( { struct task_struct *p; struct pci_dev *pdev, *rdev, *tdev; + int rc = 0; if ( !IS_PRIV(current) ) BUG(); @@ -150,18 +151,19 @@ int physdev_pci_access_modify( if ( (pdev = pci_find_slot(bus, PCI_DEVFN(dev, func))) == NULL ) { INFO(" dev does not exist\n"); - return -ENODEV; + rc = -ENODEV; + goto out; } add_dev_to_task(p, pdev, ACC_WRITE); INFO(" add RW %02x:%02x:%02x\n", pdev->bus->number, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); - /* Grant read access to the root device. */ if ( (rdev = pci_find_slot(0, PCI_DEVFN(0, 0))) == NULL ) { INFO(" bizarre -- no PCI root dev\n"); - return -ENODEV; + rc = -ENODEV; + goto out; } add_dev_to_task(p, rdev, ACC_READ); INFO(" add R0 %02x:%02x:%02x\n", 0, 0, 0); @@ -174,13 +176,13 @@ int physdev_pci_access_modify( PCI_SLOT(tdev->devfn), PCI_FUNC(tdev->devfn)); } - if ( pdev->hdr_type == PCI_HEADER_TYPE_NORMAL ) - return 0; - - /* The device is a bridge or cardbus. */ - INFO("XXX can't give access to bridge devices yet\n"); + /* Is the device a bridge or cardbus? */ + if ( pdev->hdr_type != PCI_HEADER_TYPE_NORMAL ) + INFO("XXX can't give access to bridge devices yet\n"); - return 0; + out: + put_task_struct(p); + return rc; } /* check if a domain has general access to a device */