* [PATCH] hw/pci-host/piix: fix one file descriptor leak
@ 2015-09-18 0:57 Tiejun Chen
0 siblings, 0 replies; only message in thread
From: Tiejun Chen @ 2015-09-18 0:57 UTC (permalink / raw)
To: qemu-devel, xen-devel
Cc: Paolo Bonzini, Stefano Stabellini, Michael S. Tsirkin
Commit 595a4f07d6bd (piix: create host bridge to passthrough)
introduced to leak of one file descriptor, "config_fd", now
just fix that.
CC: Michael S. Tsirkin <mst@redhat.com>
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
hw/pci-host/piix.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index 1fb71c8..7d44228 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -775,15 +775,18 @@ static int host_pci_config_read(int pos, int len, uint32_t val)
}
if (lseek(config_fd, pos, SEEK_SET) != pos) {
+ close(config_fd);
return -errno;
}
do {
rc = read(config_fd, (uint8_t *)&val, len);
} while (rc < 0 && (errno == EINTR || errno == EAGAIN));
if (rc != len) {
+ close(config_fd);
return -errno;
}
+ close(config_fd);
return 0;
}
--
1.9.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-09-18 0:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-18 0:57 [PATCH] hw/pci-host/piix: fix one file descriptor leak Tiejun Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).