Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Oleksandr Tyshchenko <Oleksandr_Tyshchenko@epam.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	Sander Eikelenboom <linux@eikelenboom.it>
Subject: Re: [PATCH] xen/xenbus: fix xenbus_setup_ring()
Date: Thu, 15 Sep 2022 16:55:52 +0200	[thread overview]
Message-ID: <643ef313-b9a8-e6ab-4dcb-43919f4d7af6@suse.com> (raw)
In-Reply-To: <34c9a80d-3a9d-cd51-32d2-cf778c981107@epam.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 1985 bytes --]

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@vger.kernel.org
>> Fixes: 4573240f0764 ("xen/xenbus: eliminate xenbus_grant_ring()")
>> Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
>> Signed-off-by: Juergen Gross <jgross@suse.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@epam.com>

Thanks,


Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3149 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

      reply	other threads:[~2022-09-15 14:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-15 14:31 [PATCH] xen/xenbus: fix xenbus_setup_ring() Juergen Gross
2022-09-15 14:45 ` Jan Beulich
2022-09-15 14:47 ` Oleksandr Tyshchenko
2022-09-15 14:55   ` Juergen Gross [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=643ef313-b9a8-e6ab-4dcb-43919f4d7af6@suse.com \
    --to=jgross@suse.com \
    --cc=Oleksandr_Tyshchenko@epam.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@eikelenboom.it \
    --cc=sstabellini@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox