All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] softmmu/qdev-monitor: fix use-after-free in qdev_set_id()
@ 2021-11-02 16:33 Stefan Hajnoczi
  2021-11-02 16:50 ` Philippe Mathieu-Daudé
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2021-11-02 16:33 UTC (permalink / raw)
  To: qemu-devel
  Cc: Damien Hedde, Kevin Wolf, Daniel P. Berrangé,
	Eduardo Habkost, Michael S . Tsirkin, Stefan Hajnoczi,
	Paolo Bonzini

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>
---
 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 4851de51a5..06f86a1a96 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -581,8 +581,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 {
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-11-15 14:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 16:33 [PATCH] softmmu/qdev-monitor: fix use-after-free in qdev_set_id() Stefan Hajnoczi
2021-11-02 16:50 ` Philippe Mathieu-Daudé
2021-11-02 17:07 ` Michael S. Tsirkin
2021-11-02 17:52 ` Kevin Wolf
2021-11-03  9:46 ` Philippe Mathieu-Daudé
2021-11-03 10:01   ` Markus Armbruster
2021-11-13  8:14     ` Markus Armbruster
2021-11-15 14:48       ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.