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] [day] [month] [year] [list]
Date:   Thu, 15 Sep 2022 16:55:52 +0200
From:   Juergen Gross <jgross@...e.com>
To:     Oleksandr Tyshchenko <Oleksandr_Tyshchenko@...m.com>,
        "xen-devel@...ts.xenproject.org" <xen-devel@...ts.xenproject.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc:     Stefano Stabellini <sstabellini@...nel.org>,
        "stable@...r.kernel.org" <stable@...r.kernel.org>,
        Sander Eikelenboom <linux@...elenboom.it>
Subject: Re: [PATCH] xen/xenbus: fix xenbus_setup_ring()

On 15.09.22 16:47, Oleksandr Tyshchenko wrote:
> 
> On 15.09.22 17:31, Juergen Gross wrote:
> 
> Hello Juergen
> 
>> Commit 4573240f0764 ("xen/xenbus: eliminate xenbus_grant_ring()")
>> introduced an error for initialization of multi-page rings.
>>
>> Cc: stable@...r.kernel.org
>> Fixes: 4573240f0764 ("xen/xenbus: eliminate xenbus_grant_ring()")
>> Reported-by: Sander Eikelenboom <linux@...elenboom.it>
>> Signed-off-by: Juergen Gross <jgross@...e.com>
>> ---
>>    drivers/xen/xenbus/xenbus_client.c | 9 ++++++---
>>    1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
>> index d5f3f763717e..caa5c5c32f8e 100644
>> --- a/drivers/xen/xenbus/xenbus_client.c
>> +++ b/drivers/xen/xenbus/xenbus_client.c
>> @@ -382,9 +382,10 @@ int xenbus_setup_ring(struct xenbus_device *dev, gfp_t gfp, void **vaddr,
>>    	unsigned long ring_size = nr_pages * XEN_PAGE_SIZE;
>>    	grant_ref_t gref_head;
>>    	unsigned int i;
>> +	void *addr;
>>    	int ret;
>>    
>> -	*vaddr = alloc_pages_exact(ring_size, gfp | __GFP_ZERO);
>> +	addr = *vaddr = alloc_pages_exact(ring_size, gfp | __GFP_ZERO);
>>    	if (!*vaddr) {
>>    		ret = -ENOMEM;
>>    		goto err;
>> @@ -401,13 +402,15 @@ int xenbus_setup_ring(struct xenbus_device *dev, gfp_t gfp, void **vaddr,
>>    		unsigned long gfn;
>>    
>>    		if (is_vmalloc_addr(*vaddr))
>> -			gfn = pfn_to_gfn(vmalloc_to_pfn(vaddr[i]));
>> +			gfn = pfn_to_gfn(vmalloc_to_pfn(addr));
>>    		else
>> -			gfn = virt_to_gfn(vaddr[i]);
>> +			gfn = virt_to_gfn(addr);
>>    
>>    		grefs[i] = gnttab_claim_grant_reference(&gref_head);
>>    		gnttab_grant_foreign_access_ref(grefs[i], dev->otherend_id,
>>    						gfn, 0);
>> +
>> +		addr += PAGE_SIZE;
> 
> XEN_PAGE_SIZE?

Oh, indeed! Will change on commit.

> 
> 
> Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>

Thanks,


Juergen

Download attachment "OpenPGP_0xB0DE9DD628BF132F.asc" of type "application/pgp-keys" (3099 bytes)

Download attachment "OpenPGP_signature" of type "application/pgp-signature" (496 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ