lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a6086ba5-6137-44a0-9e51-ce4df5eb6ce4@redhat.com>
Date: Fri, 19 Apr 2024 14:58:43 +0200
From: David Hildenbrand <david@...hat.com>
To: Michael Roth <michael.roth@....com>, kvm@...r.kernel.org
Cc: linux-coco@...ts.linux.dev, linux-mm@...ck.org,
 linux-crypto@...r.kernel.org, x86@...nel.org, linux-kernel@...r.kernel.org,
 tglx@...utronix.de, mingo@...hat.com, jroedel@...e.de,
 thomas.lendacky@....com, hpa@...or.com, ardb@...nel.org,
 pbonzini@...hat.com, seanjc@...gle.com, vkuznets@...hat.com,
 jmattson@...gle.com, luto@...nel.org, dave.hansen@...ux.intel.com,
 slp@...hat.com, pgonda@...gle.com, peterz@...radead.org,
 srinivas.pandruvada@...ux.intel.com, rientjes@...gle.com,
 dovmurik@...ux.ibm.com, tobin@....com, bp@...en8.de, vbabka@...e.cz,
 kirill@...temov.name, ak@...ux.intel.com, tony.luck@...el.com,
 sathyanarayanan.kuppuswamy@...ux.intel.com, alpergun@...gle.com,
 jarkko@...nel.org, ashish.kalra@....com, nikunj.dadhania@....com,
 pankaj.gupta@....com, liam.merwick@...cle.com
Subject: Re: [PATCH v13 04/26] KVM: guest_memfd: Fix PTR_ERR() handling in
 __kvm_gmem_get_pfn()

On 18.04.24 21:41, Michael Roth wrote:
> kvm_gmem_get_folio() may return a PTR_ERR() rather than just NULL. In
> particular, for cases where EEXISTS is returned when FGP_CREAT_ONLY
> flag is used. Handle this properly in __kvm_gmem_get_pfn().
> 
> Signed-off-by: Michael Roth <michael.roth@....com>
> ---
>   virt/kvm/guest_memfd.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c
> index ccf22e44f387..9d7c6a70c547 100644
> --- a/virt/kvm/guest_memfd.c
> +++ b/virt/kvm/guest_memfd.c
> @@ -580,8 +580,8 @@ static int __kvm_gmem_get_pfn(struct file *file, struct kvm_memory_slot *slot,
>   	}
>   
>   	folio = kvm_gmem_get_folio(file_inode(file), index, prepare);
> -	if (!folio)
> -		return -ENOMEM;
> +	if (IS_ERR_OR_NULL(folio))
> +		return folio ? PTR_ERR(folio) : -ENOMEM;

Will it even return NULL?  Staring at other filemap_grab_folio() users, 
they all check for IS_ERR().

>   
>   	if (folio_test_hwpoison(folio)) {
>   		r = -EHWPOISON;

Do we have a Fixes: tag?

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ