Re: [PATCH] device-assignment: Better fd tracking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/07/2010 07:29 PM, Alex Williamson wrote:
Commit 909bfdba fixed a hole with not closing resource file descriptors
but we need to be more careful about tracking which are real fds,
otherwise we might close fd 0, which doesn't work out so well for stdio.

@@ -785,7 +786,8 @@ static void free_assigned_device(AssignedDevice *dev)
                          fprintf(stderr,
  				"Failed to unmap assigned device region: %s\n",
  				strerror(errno));
-                    close(pci_region->resource_fd);
+                    if (pci_region->resource_fd>= 0)
+                        close(pci_region->resource_fd);

Missing  { }s.

                  }
  	    }
          }
@@ -793,10 +795,8 @@ static void free_assigned_device(AssignedDevice *dev)
          if (dev->cap.available&  ASSIGNED_DEVICE_CAP_MSIX)
              assigned_dev_unregister_msix_mmio(dev);

-        if (dev->real_device.config_fd) {
+        if (dev->real_device.config_fd>= 0)
              close(dev->real_device.config_fd);
-            dev->real_device.config_fd = 0;
-        }

Again.


  #ifdef KVM_CAP_IRQ_ROUTING
          free_dev_irq_entries(dev);
@@ -1415,7 +1415,7 @@ static int assigned_initfn(struct PCIDevice *pci_dev)

      if (!dev->host.seg&&  !dev->host.bus&&  !dev->host.dev&&  !dev->host.func) {
          error_report("pci-assign: error: no host device specified");
-        goto out;
+        return -1;
      }

-error is better than -1, but this is not introduces by this patch, so okay.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux