[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191107170258.36379-2-leonardo@linux.ibm.com>
Date: Thu, 7 Nov 2019 14:02:55 -0300
From: Leonardo Bras <leonardo@...ux.ibm.com>
To: kvm-ppc@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-kernel@...r.kernel.org
Cc: Leonardo Bras <leonardo@...ux.ibm.com>,
Paul Mackerras <paulus@...abs.org>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Michael Ellerman <mpe@...erman.id.au>
Subject: [PATCH v2 1/4] powerpc/kvm/book3s: Fixes possible 'use after release' of kvm
Fixes a possible 'use after free' of kvm variable in
kvm_vm_ioctl_create_spapr_tce, where it does a mutex_unlock(&kvm->lock)
after a kvm_put_kvm(kvm).
Signed-off-by: Leonardo Bras <leonardo@...ux.ibm.com>
---
arch/powerpc/kvm/book3s_64_vio.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
index 5834db0a54c6..a402ead833b6 100644
--- a/arch/powerpc/kvm/book3s_64_vio.c
+++ b/arch/powerpc/kvm/book3s_64_vio.c
@@ -316,14 +316,13 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
if (ret >= 0)
list_add_rcu(&stt->list, &kvm->arch.spapr_tce_tables);
- else
- kvm_put_kvm(kvm);
mutex_unlock(&kvm->lock);
if (ret >= 0)
return ret;
+ kvm_put_kvm(kvm);
kfree(stt);
fail_acct:
account_locked_vm(current->mm, kvmppc_stt_pages(npages), false);
--
2.23.0
Powered by blists - more mailing lists