aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Thierry <julien.thierry@arm.com>2018-08-14 18:03:56 +0100
committerWill Deacon <will.deacon@arm.com>2018-08-16 11:30:18 +0100
commit971ba8ccff299dd41b0e2db655a6b99f3eb2ae0b (patch)
tree2489384e9d1a50ab796351cc7fdea39f9498e31f
parentdc4291bae21842dedbf7a10091ebbfec29ecfbd2 (diff)
downloadkvmtool-971ba8ccff299dd41b0e2db655a6b99f3eb2ae0b.tar.gz
ioport: unregister port device when unregistering port
Ioport register bus devices when they registered. These devices are not unregistered when the ioports entries containing their headers are unregistered. This results in dangling pointers in the device rb_tree. Unregister ioport bus devices when the ioport is unregistered. Signed-off-by: Julien Thierry <julien.thierry@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r--ioport.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ioport.c b/ioport.c
index 263fe50f..505e8220 100644
--- a/ioport.c
+++ b/ioport.c
@@ -133,6 +133,7 @@ int ioport__unregister(struct kvm *kvm, u16 port)
if (!entry)
goto done;
+ device__unregister(&entry->dev_hdr);
ioport_remove(&ioport_tree, entry);
free(entry);
@@ -155,6 +156,7 @@ static void ioport__unregister_all(void)
while (rb) {
rb_node = rb_int(rb);
entry = ioport_node(rb_node);
+ device__unregister(&entry->dev_hdr);
ioport_remove(&ioport_tree, entry);
free(entry);
rb = rb_first(&ioport_tree);