]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Fix potential fput on a null source_kvm_file
authorColin Ian King <colin.king@canonical.com>
Fri, 30 Apr 2021 17:03:03 +0000 (18:03 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 3 May 2021 15:25:40 +0000 (11:25 -0400)
commit4856f6fd42d381cc2f5a1a81be617cdc3dc40379
treef216b9cbf7ddc89a3bdccbf6fe14006d70ee34ad
parent5f8ea5459feff0d61238c7a8aef5808a7ab92d0e
KVM: x86: Fix potential fput on a null source_kvm_file

The fget can potentially return null, so the fput on the error return
path can cause a null pointer dereference. Fix this by checking for
a null source_kvm_file before doing a fput.

Addresses-Coverity: ("Dereference null return")
Fixes: 90d0c700aaf0 ("KVM: x86: Support KVM VMs sharing SEV context")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Message-Id: <20210430170303.131924-1-colin.king@canonical.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/sev.c