]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: PPC: Book3S HV: XIVE: fix rollback when kvmppc_xive_create fails
authorCédric Le Goater <clg@kaod.org>
Thu, 18 Jul 2019 21:51:54 +0000 (23:51 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 19 Jul 2019 03:41:12 +0000 (13:41 +1000)
commit826d2d5c34358e95e2425b9b7f8c96793f69fce8
tree48da83581c241db13960f4188f9c1664e7ccb9e6
parentd1f4e8096d715068d19fb4d5eebe637cc49e5afc
KVM: PPC: Book3S HV: XIVE: fix rollback when kvmppc_xive_create fails

The XIVE device structure is now allocated in kvmppc_xive_get_device()
and kfree'd in kvmppc_core_destroy_vm(). In case of an OPAL error when
allocating the XIVE VPs, the kfree() call in kvmppc_xive_*create()
will result in a double free and corrupt the host memory.

Fixes: aba52dee091e ("KVM: PPC: Book3S HV: XIVE: Replace the 'destroy' method by a 'release' method")
Cc: stable@vger.kernel.org # v5.2+
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/6ea6998b-a890-2511-01d1-747d7621eb19@kaod.org
arch/powerpc/kvm/book3s_xive.c
arch/powerpc/kvm/book3s_xive_native.c