OSDN Git Service

KVM: arm/arm64: vgic: Fix kvm_device leak in vgic_its_destroy
authorDave Martin <Dave.Martin@arm.com>
Thu, 6 Jun 2019 10:58:07 +0000 (11:58 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Jul 2019 07:05:54 +0000 (09:05 +0200)
commit866e8eb5ad1813113030a98e31714e707e03954b
tree5a2656826800a9a51ec20858e5114abd049b6832
parenta31d4c8b2ba6e33a70ff462189b92a5808ea6b49
KVM: arm/arm64: vgic: Fix kvm_device leak in vgic_its_destroy

[ Upstream commit 4729ec8c1e1145234aeeebad5d96d77f4ccbb00a ]

kvm_device->destroy() seems to be supposed to free its kvm_device
struct, but vgic_its_destroy() is not currently doing this,
resulting in a memory leak, resulting in kmemleak reports such as
the following:

unreferenced object 0xffff800aeddfe280 (size 128):
  comm "qemu-system-aar", pid 13799, jiffies 4299827317 (age 1569.844s)
  [...]
  backtrace:
    [<00000000a08b80e2>] kmem_cache_alloc+0x178/0x208
    [<00000000dcad2bd3>] kvm_vm_ioctl+0x350/0xbc0

Fix it.

Cc: Andre Przywara <andre.przywara@arm.com>
Fixes: 1085fdc68c60 ("KVM: arm64: vgic-its: Introduce new KVM ITS device")
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
virt/kvm/arm/vgic/vgic-its.c