From: Sean Christopherson Date: Fri, 31 Jul 2020 20:18:59 +0000 Subject: Re: [PATCH] KVM: SVM: Fix sev_pin_memory() error handling Message-Id: <20200731201859.GF31451@linux.intel.com> List-Id: References: <20200714142351.GA315374@mwanda> In-Reply-To: <20200714142351.GA315374@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Dan Carpenter Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , kvm@vger.kernel.org, kernel-janitors@vger.kernel.org On Tue, Jul 14, 2020 at 05:23:51PM +0300, Dan Carpenter wrote: > The sev_pin_memory() function was modified to return error pointers > instead of NULL but there are two problems. The first problem is that > if "npages" is zero then it still returns NULL. Secondly, several of > the callers were not updated to check for error pointers instead of > NULL. > > Either one of these issues will lead to an Oops. > > Fixes: a8d908b5873c ("KVM: x86: report sev_pin_memory errors with PTR_ERR") Explicit Cc: to stable needed for KVM patches. > Signed-off-by: Dan Carpenter Reviewed-by: Sean Christopherson