qemu/hw
Anthony PERARD 36d883ba0d xen-block: Fix double qlist remove and request leak
Commit a31ca6801c ("qemu/queue.h: clear linked list pointers on
remove") revealed that a request was removed twice from a list, once
in xen_block_finish_request() and a second time in
xen_block_release_request() when both function are called from
xen_block_complete_aio(). But also, the `requests_inflight' counter is
decreased twice, and thus became negative.

This is a bug that was introduced in bfd0d63660 ("xen-block: improve
response latency"), where a `finished' list was removed.

That commit also introduced a leak of request in xen_block_do_aio().
That function calls xen_block_finish_request() but the request is
never released after that.

To fix both issue, we do two changes:
- we squash finish_request() and release_request() together as we want
  to remove a request from 'inflight' list to add it to 'freelist'.
- before releasing a request, we need to let the other end know the
  result, thus we should call xen_block_send_response() before
  releasing a request.

The first change fixes the double QLIST_REMOVE() as we remove the extra
call. The second change makes the leak go away because if we want to
call finish_request(), we need to call a function that does all of
finish, send response, and release.

Fixes: bfd0d63660 ("xen-block: improve response latency")
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Message-Id: <20200406140217.1441858-1-anthony.perard@citrix.com>
Reviewed-by: Paul Durrant <paul@xen.org>
[mreitz: Amended commit message as per Paul's suggestions]
Signed-off-by: Max Reitz <mreitz@redhat.com>
2020-04-07 13:51:09 +02:00
..
9pfs
acpi acpi: pcihp: fix left shift undefined behavior in acpi_pcihp_eject_slot() 2020-03-29 09:52:13 -04:00
adc
alpha
arm hw/arm/collie: Put StrongARMState* into a CollieMachineState struct 2020-04-03 19:23:37 +01:00
audio hw/audio/fmopl: fix segmentation fault 2020-03-25 09:55:40 +01:00
block xen-block: Fix double qlist remove and request leak 2020-04-07 13:51:09 +02:00
char serial: Fix double migration data 2020-04-02 14:55:45 -04:00
core
cpu
cris
display
dma dma/xlnx-zdma: Reorg to fix CUR_DSCR 2020-04-06 10:59:56 +01:00
gpio hw/gpio/aspeed_gpio.c: Don't directly include assert.h 2020-04-03 19:24:53 +01:00
hppa
hyperv
i2c
i386 i386: Fix pkg_id offset for EPYC cpu models 2020-03-31 19:13:32 -03:00
ide cmd646-ide: use qdev gpio rather than qemu_allocate_irqs() 2020-03-27 14:30:08 -04:00
input
intc
ipack
ipmi
isa hw/isa/superio: Correct the license text 2020-04-01 19:00:16 +02:00
lm32
m68k
mem
microblaze
mips
misc hw/misc/allwinner-h3-dramc: enforce 64-bit multiply when calculating row mirror address 2020-03-30 13:18:58 +01:00
moxie
net hw/net/allwinner-sun8i-emac.c: Fix REG_ADDR_HIGH/LOW reads 2020-03-31 21:14:35 +08:00
nios2
nubus
nvram
openrisc
pci
pci-bridge
pci-host
pcmcia
ppc
rdma
riscv
rtc
s390x vl/s390x: fixup ram sizes for compat machines 2020-04-02 17:10:09 +02:00
scsi hw/scsi/vmw_pvscsi: Remove assertion for kick after reset 2020-04-01 19:00:16 +02:00
sd
semihosting
sh4
smbios
sparc
sparc64
ssi
timer
tpm
tricore
unicore32
usb
vfio
virtio virtio-iommu: depend on PCI 2020-04-01 19:00:16 +02:00
watchdog
xen xen: fixup RAM memory region initialization 2020-04-02 14:56:29 -04:00
xenpv
xtensa
Kconfig
Makefile.objs