WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

Re: [Xen-ia64-devel] [PATCH] Fix a bug in xencomm_copy_from/to_guest()

To: SUZUKI Kazuhiro <kaz@xxxxxxxxxxxxxx>
Subject: Re: [Xen-ia64-devel] [PATCH] Fix a bug in xencomm_copy_from/to_guest()
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Wed, 27 Dec 2006 19:16:16 +0900
Cc: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 27 Dec 2006 02:16:09 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20061227.182726.123579025.kaz@xxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20061227.182726.123579025.kaz@xxxxxxxxxxxxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
Hi Kaz.

On Wed, Dec 27, 2006 at 06:27:26PM +0900, SUZUKI Kazuhiro wrote:
> diff -r 80c5b5914b79 xen/arch/ia64/xen/xencomm.c
> --- a/xen/arch/ia64/xen/xencomm.c     Wed Dec 20 14:55:02 2006 -0700
> +++ b/xen/arch/ia64/xen/xencomm.c     Wed Dec 27 18:03:10 2006 +0900
> @@ -148,6 +148,13 @@ xencomm_copy_from_guest(
>          pgoffset = src_paddr % PAGE_SIZE;
>          chunksz = PAGE_SIZE - pgoffset;
>  
> +        if (chunksz <= skip) {
> +            from_pos += chunksz;
> +            skip -= chunksz;
> +            i++;
> +            continue;
> +        }
> +
>          chunk_skip = min(chunksz, skip);
>          from_pos += chunk_skip;
>          chunksz -= chunk_skip;

This condition looks odd.
I guess the issues which you've seen is 
calling xencomm_copy_chunk_{to, from} with len = 0.
(If I'm wrong, correct me.)
The patch should looks like as follows.
And xen/common/xencomm.c should modified similary too.

--- xen/arch/ia64/xen/xencomm.c   2006-12-21 12:05:05.000000000 +0900
+++ xen/arch/ia64/xen/xencomm.c.new       2006-12-27 19:12:19.000000000 +0900
@@ -153,7 +153,7 @@ xencomm_copy_from_guest(
         chunksz -= chunk_skip;
         skip -= chunk_skip;
 
-        if (skip == 0) {
+        if (skip == 0 && chunksz > 0) {
             unsigned int bytes = min(chunksz, n - to_pos);
            int res;
 
@@ -295,7 +295,7 @@ xencomm_copy_to_guest(
         skip -= chunk_skip;
         dest_paddr += chunk_skip;
 
-        if (skip == 0) {
+        if (skip == 0 && chunksz > 0) {
             unsigned int bytes = min(chunksz, n - from_pos);
             int res;
-- 
yamahata

_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel

<Prev in Thread] Current Thread [Next in Thread>