Skip to contentSkip to conversation

qemu-char: Fix ID reuse after chardev-remove for qapi-based init

PATCH Applied Markus Armbruster 3 participants 3 messages Jun 27, 2013 – Jul 1, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-char: Fix ID reuse after chardev-remove for qapi-based init

Commit 2c5f488 introduced qapi-based character device initialization as a new code path in qemu_chr_new_from_opts(). Unfortunately, it failed to store parameter opts in the new chardev. Therefore, qemu_chr_delete() doesn't delete it. Even though the device is gone, its options linger, and any attempt to create another one with the same ID fails.

---
 qemu-char.c | 1 +
 1 file changed, 1 insertion(+)
qemu-char.c +1 -0
index a030e6b..63972ae 100644
@@ -3219,6 +3219,7 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
         }
 
         chr = qemu_chr_find(id);
+        chr->opts = opts;
 
     qapi_out:
         qapi_free_ChardevBackend(backend);
Signature · 1 line
1.7.11.7
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Markus Armbruster

Commit 2c5f488 introduced qapi-based character device initialization as a new code path in qemu_chr_new_from_opts(). Unfortunately, it failed to store parameter opts in the new chardev. Therefore, qemu_chr_delete() doesn't delete it. Even though the device is gone, its options linger, and any attempt to create another one with the same ID fails.

cheers,
Gerd