Commit 971ba8cc authored by Julien Thierry's avatar Julien Thierry Committed by Will Deacon
Browse files

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: default avatarJulien Thierry <julien.thierry@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent dc4291ba
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment