]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: fix memory leak in kvm_io_bus_unregister_dev()
authorRustam Kovhaev <rkovhaev@gmail.com>
Mon, 7 Sep 2020 18:55:35 +0000 (11:55 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 11 Sep 2020 17:15:11 +0000 (13:15 -0400)
commit2c28244e303c20c5be794c751e7f70b6336166f8
tree4b6113de58850a3427ee5d31f80d9fb8ce228e7a
parenta431912053dcc965e068128fea759eb0cf961df1
KVM: fix memory leak in kvm_io_bus_unregister_dev()

when kmalloc() fails in kvm_io_bus_unregister_dev(), before removing
the bus, we should iterate over all other devices linked to it and call
kvm_iodevice_destructor() for them

Fixes: 0d8258671188 ("KVM: kvm_io_bus_unregister_dev() should never fail")
Cc: stable@vger.kernel.org
Reported-and-tested-by: syzbot+f196caa45793d6374707@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=f196caa45793d6374707
Signed-off-by: Rustam Kovhaev <rkovhaev@gmail.com>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20200907185535.233114-1-rkovhaev@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/kvm_main.c