qemu-e2k/hw/usb
Daniel P. Berrangé b4682a63f8 filemon: fix watch IDs to avoid potential wraparound issues
Watch IDs are allocated from incrementing a int counter against
the QFileMonitor object. In very long life QEMU processes with
a huge amount of USB MTP activity creating & deleting directories
it is just about conceivable that the int counter can wrap
around. This would result in incorrect behaviour of the file
monitor watch APIs due to clashing watch IDs.

Instead of trying to detect this situation, this patch changes
the way watch IDs are allocated. It is turned into an int64_t
variable where the high 32 bits are set from the underlying
inotify "int" ID. This gives an ID that is guaranteed unique
for the directory as a whole, and we can rely on the kernel
to enforce this. QFileMonitor then sets the low 32 bits from
a per-directory counter.

The USB MTP device only sets watches on the directory as a
whole, not files within, so there is no risk of guest
triggered wrap around on the low 32 bits.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-04-02 13:52:02 +01:00
..
bus.c hw/usb/bus.c: Handle "no speed matched" case in usb_mask_to_str() 2019-04-01 08:53:44 +02:00
ccid-card-emulated.c qemu/queue.h: leave head structs anonymous unless necessary 2019-01-11 15:46:55 +01:00
ccid-card-passthru.c
ccid.h
chipidea.c
combined-packet.c hw/usb: Fix LGPL information in the file headers 2019-01-30 06:47:52 +01:00
core.c usb: remove unnecessary NULL device check from usb_ep_get() 2019-02-20 09:41:23 +01:00
desc-msos.c
desc.c
desc.h
dev-audio.c audio: use qapi AudioFormat instead of audfmt_e 2019-03-11 10:29:26 +01:00
dev-bluetooth.c avoid TABs in files that only contain a few 2019-01-11 15:46:56 +01:00
dev-hid.c usb: assign unique serial numbers to hid devices 2019-01-30 06:47:52 +01:00
dev-hub.c avoid TABs in files that only contain a few 2019-01-11 15:46:56 +01:00
dev-mtp.c filemon: fix watch IDs to avoid potential wraparound issues 2019-04-02 13:52:02 +01:00
dev-network.c qemu/queue.h: leave head structs anonymous unless necessary 2019-01-11 15:46:55 +01:00
dev-serial.c char: allow specifying a GMainContext at opening time 2019-02-13 14:23:39 +01:00
dev-smartcard-reader.c qdev: pass an Object * to qbus_set_hotplug_handler() 2019-02-17 21:54:02 +11:00
dev-storage.c block: Remove deprecated -drive option serial 2018-08-15 12:50:39 +02:00
dev-uas.c
dev-wacom.c
hcd-ehci-pci.c hw/usb: Fix LGPL information in the file headers 2019-01-30 06:47:52 +01:00
hcd-ehci-sysbus.c hw/usb: Fix LGPL information in the file headers 2019-01-30 06:47:52 +01:00
hcd-ehci.c ehci: check device is not NULL before calling usb_ep_get() 2019-02-20 09:41:23 +01:00
hcd-ehci.h hw/usb: Fix LGPL information in the file headers 2019-01-30 06:47:52 +01:00
hcd-musb.c usb: check device is not NULL before calling usb_ep_get() 2019-02-20 09:41:23 +01:00
hcd-ohci.c ohci: don't die on ED_LINK_LIMIT overflow 2019-03-26 12:01:45 +01:00
hcd-uhci.c uhci: check device is not NULL before calling usb_ep_get() 2019-02-20 09:41:23 +01:00
hcd-xhci-nec.c
hcd-xhci.c xhci: check device is not NULL before calling usb_ep_get() 2019-02-20 09:41:23 +01:00
hcd-xhci.h usb: implement XHCI underrun/overrun events 2019-01-30 06:47:52 +01:00
host-libusb.c Introduce new "no_guest_reset" parameter for usb-host device 2019-03-07 10:03:54 +01:00
host-stub.c
host.h
Kconfig scsi: express dependencies with Kconfig 2019-03-07 21:45:53 +01:00
libhw.c
Makefile.objs build: convert usb.mak to Kconfig 2019-03-07 21:45:53 +01:00
quirks-ftdi-ids.h
quirks-pl2303-ids.h
quirks.c
quirks.h
redirect.c usb: add device checks before redirector calls to usb_ep_get() 2019-02-20 09:41:23 +01:00
trace-events trace-events: Shorten file names in comments 2019-03-22 16:18:07 +00:00
tusb6010.c hw: Remove unused 'hw/devices.h' include 2019-03-07 22:16:11 +01:00
xen-usb.c xen: re-name XenDevice to XenLegacyDevice... 2019-01-14 13:45:40 +00:00