KVM: nSVM: Avoid freeing uninitialized pointers in svm_set_nested_state()
The save and ctl pointers are passed uninitialized to kfree() when svm_set_nested_state() follows the 'goto out_set_gif' path. While the issue could've been fixed by initializing these on-stack varialbles to NULL, it seems preferable to eliminate 'out_set_gif' label completely as it is not actually a failure path and duplicating a single svm_set_gif() call doesn't look too bad. [ bp: Drop obscure Addresses-Coverity: tag. ] Fixes: 6ccbd29a ("KVM: SVM: nested: Don't allocate VMCB structures on stack") Reported-by: NDan Carpenter <dan.carpenter@oracle.com> Reported-by: NJoerg Roedel <jroedel@suse.de> Reported-by: NColin King <colin.king@canonical.com> Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: NBorislav Petkov <bp@suse.de> Reviewed-by: NSean Christopherson <sean.j.christopherson@intel.com> Acked-by: NJoerg Roedel <jroedel@suse.de> Tested-by: NTom Lendacky <thomas.lendacky@amd.com> Link: https://lkml.kernel.org/r/20200914133725.650221-1-vkuznets@redhat.comSigned-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Showing
想要评论请 注册 或 登录