[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 08/74] megasas: fix sglist leak
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 08/74] megasas: fix sglist leak |
Date: |
Tue, 21 Aug 2018 19:01:40 +0200 |
From: Marc-André Lureau <address@hidden>
tests/cdrom-test -p /x86_64/cdrom/boot/megasas
Produces the following ASAN leak.
==25700==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 16 byte(s) in 1 object(s) allocated from:
#0 0x7f06f8faac48 in malloc (/lib64/libasan.so.5+0xeec48)
#1 0x7f06f87a73c5 in g_malloc (/lib64/libglib-2.0.so.0+0x523c5)
#2 0x55a729f17738 in pci_dma_sglist_init
/home/elmarco/src/qq/include/hw/pci/pci.h:818
#3 0x55a729f2a706 in megasas_map_dcmd
/home/elmarco/src/qq/hw/scsi/megasas.c:698
#4 0x55a729f39421 in megasas_handle_dcmd
/home/elmarco/src/qq/hw/scsi/megasas.c:1574
#5 0x55a729f3f70d in megasas_handle_frame
/home/elmarco/src/qq/hw/scsi/megasas.c:1955
#6 0x55a729f40939 in megasas_mmio_write
/home/elmarco/src/qq/hw/scsi/megasas.c:2119
#7 0x55a729f41102 in megasas_port_write
/home/elmarco/src/qq/hw/scsi/megasas.c:2170
#8 0x55a729220e60 in memory_region_write_accessor
/home/elmarco/src/qq/memory.c:527
#9 0x55a7292212b3 in access_with_adjusted_size
/home/elmarco/src/qq/memory.c:594
#10 0x55a72922cf70 in memory_region_dispatch_write
/home/elmarco/src/qq/memory.c:1473
#11 0x55a7290f5907 in flatview_write_continue
/home/elmarco/src/qq/exec.c:3255
#12 0x55a7290f5ceb in flatview_write /home/elmarco/src/qq/exec.c:3294
#13 0x55a7290f6457 in address_space_write /home/elmarco/src/qq/exec.c:3384
#14 0x55a7290f64a8 in address_space_rw /home/elmarco/src/qq/exec.c:3395
#15 0x55a72929ecb0 in kvm_handle_io
/home/elmarco/src/qq/accel/kvm/kvm-all.c:1729
#16 0x55a7292a0db5 in kvm_cpu_exec
/home/elmarco/src/qq/accel/kvm/kvm-all.c:1969
#17 0x55a7291c4212 in qemu_kvm_cpu_thread_fn
/home/elmarco/src/qq/cpus.c:1215
#18 0x55a72a966a6c in qemu_thread_start
/home/elmarco/src/qq/util/qemu-thread-posix.c:504
#19 0x7f06ed486593 in start_thread (/lib64/libpthread.so.0+0x7593)
Move the qemu_sglist_destroy() from megasas_complete_command() to
megasas_unmap_frame(), so map/unmap are balanced.
Signed-off-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Marc-André Lureau <address@hidden>
---
hw/scsi/megasas.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index ba1afa3..a56317e 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -464,6 +464,7 @@ static void megasas_unmap_frame(MegasasState *s, MegasasCmd
*cmd)
cmd->frame = NULL;
cmd->pa = 0;
cmd->pa_size = 0;
+ qemu_sglist_destroy(&cmd->qsg);
clear_bit(cmd->index, s->frame_map);
}
@@ -580,7 +581,6 @@ static void megasas_complete_frame(MegasasState *s,
uint64_t context)
static void megasas_complete_command(MegasasCmd *cmd)
{
- qemu_sglist_destroy(&cmd->qsg);
cmd->iov_size = 0;
cmd->iov_offset = 0;
--
1.8.3.1
- [Qemu-devel] [PULL 00/74] Misc patches for 2018-08-21, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 03/74] es1370: simplify MemoryRegionOps, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 10/74] tests/migration-test: Silence the kvm_hv message by default, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 04/74] fix "Missing break in switch" coverity reports, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 06/74] qemu-pr-helper: Fix build on CentOS 7, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 02/74] scsi: mptsas: Mark as storage device, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 05/74] checkpatch: fix filename detection when using -f, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 01/74] tests: virtio: separate ccw tests from libqos, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 09/74] MAINTAINERS: add maintainers for qtest, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 11/74] net: Silence 'has no peer' messages in testing mode, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 08/74] megasas: fix sglist leak,
Paolo Bonzini <=
- [Qemu-devel] [PULL 12/74] hw/timer/mc146818rtc: White space clean-up, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 07/74] chardev/char-fe: Fix typos, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 13/74] hw/timer/mc146818rtc: Fix introspection problem, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 15/74] tests/device-introspection: Check that the qom-tree and qtree do not change, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 14/74] tests: Skip old versioned machine types in quick testing mode, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 24/74] vl: add -enable-sync-profile, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 20/74] qsp: add qsp_reset, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 16/74] tests/device-introspect: Test with all machines, not only with "none", Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 22/74] qsp: track BQL callers explicitly, Paolo Bonzini, 2018/08/21
- [Qemu-devel] [PULL 19/74] qsp: add sort_by option to qsp_report, Paolo Bonzini, 2018/08/21