[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/20] softmmu/qdev-monitor: fix use-after-free in qdev_set_id()
From: |
Michael S. Tsirkin |
Subject: |
[PULL 02/20] softmmu/qdev-monitor: fix use-after-free in qdev_set_id() |
Date: |
Mon, 15 Nov 2021 11:37:25 -0500 |
From: Stefan Hajnoczi <stefanha@redhat.com>
Reported by Coverity (CID 1465222).
Fixes: 4a1d937796de0fecd8b22d7dbebf87f38e8282fd ("softmmu/qdev-monitor: add
error handling in qdev_set_id")
Cc: Damien Hedde <damien.hedde@greensocs.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20211102163342.31162-1-stefanha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
softmmu/qdev-monitor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index f8b3a4cd82..588a62b88d 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -593,8 +593,8 @@ const char *qdev_set_id(DeviceState *dev, char *id, Error
**errp)
if (prop) {
dev->id = id;
} else {
- g_free(id);
error_setg(errp, "Duplicate device ID '%s'", id);
+ g_free(id);
return NULL;
}
} else {
--
MST
- [PULL 00/20] pci,pc,virtio: bugfixes, Michael S. Tsirkin, 2021/11/15
- [PULL 01/20] net/vhost-vdpa: fix memory leak in vhost_vdpa_get_max_queue_pairs(), Michael S. Tsirkin, 2021/11/15
- [PULL 02/20] softmmu/qdev-monitor: fix use-after-free in qdev_set_id(),
Michael S. Tsirkin <=
- [PULL 04/20] vhost: Fix last vq queue index of devices with no cvq, Michael S. Tsirkin, 2021/11/15
- [PULL 06/20] pcie: rename 'native-hotplug' to 'x-native-hotplug', Michael S. Tsirkin, 2021/11/15
- [PULL 05/20] hw/mem/pc-dimm: Restrict NUMA-specific code to NUMA machines, Michael S. Tsirkin, 2021/11/15
- [PULL 07/20] hw/acpi/ich9: Add compat prop to keep HPC bit set for 6.1 machine type, Michael S. Tsirkin, 2021/11/15
- [PULL 08/20] bios-tables-test: Allow changes in DSDT ACPI tables, Michael S. Tsirkin, 2021/11/15
- [PULL 09/20] hw/i386/acpi-build: Deny control on PCIe Native Hot-plug in _OSC, Michael S. Tsirkin, 2021/11/15
- [PULL 10/20] tests: bios-tables-test update expected blobs, Michael S. Tsirkin, 2021/11/15
- [PULL 11/20] virtio: use virtio accessor to access packed descriptor flags, Michael S. Tsirkin, 2021/11/15
- [PULL 12/20] virtio: use virtio accessor to access packed event, Michael S. Tsirkin, 2021/11/15
- [PULL 13/20] vdpa: Replace qemu_open_old by qemu_open at, Michael S. Tsirkin, 2021/11/15