Skip to contentSkip to conversation

fix xencomm_copy_{from, to}_guest.

PATCH In review Isaku Yamahata 3 participants 4 messages Jan 5, 2007 – Jan 9, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix xencomm_copy_{from, to}_guest.

fix xencomm_copy_{from, to}_guest.
It should not call paddr_to_maddr() with invalid address.

Originally this issue was found in xen/ia64 xencomm code and in fact I didn't test this patch because currently ia64 xencomm forked from common code. They should be consolidated somehow.

Signature · 1 line
yamahata

# HG changeset patch
# User [email protected]
# Date 1167966417 -32400
# Node ID 25cdcc5f21f8147371aed5fb8f56d93479df0ca8 # Parent 338ceb7b1f0993bf9735c0c1c5d21e39c381cf2f fix xencomm_copy_{from, to}_guest.
It should not call paddr_to_maddr() with invalid address.
PATCHNAME: fix_xencomm_copy_tofrom_guest

xen/common/xencomm.c +2 -2
diff -r 338ceb7b1f09 -r 25cdcc5f21f8 xen/common/xencomm.c
@@ -119,7 +119,7 @@ xencomm_copy_from_guest(void *to, const 
         chunksz -= chunk_skip;
         skip -= chunk_skip;
 
-        if (skip == 0) {
+        if (skip == 0 && chunksz > 0) {
             unsigned long src_maddr;
             unsigned long dest = (unsigned long)to + to_pos;
             unsigned int bytes = min(chunksz, n - to_pos);
@@ -225,7 +225,7 @@ xencomm_copy_to_guest(void *to, const vo
         chunksz -= chunk_skip;
         skip -= chunk_skip;
 
-        if (skip == 0) {
+        if (skip == 0 && chunksz > 0) {
             unsigned long dest_maddr;
             unsigned long source = (unsigned long)from + from_pos;
             unsigned int bytes = min(chunksz, n - from_pos);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 2 lines · Isaku Yamahata

fix xencomm_copy_{from, to}_guest.
It should not call paddr_to_maddr() with invalid address.

Thanks Yamahata-san! I've asked Jerone (CCed) to give this a quick test.

Quoted 3 lines

Originally this issue was found in xen/ia64 xencomm code and in fact I didn't test this patch because currently ia64 xencomm forked from common code. They should be consolidated somehow.

I couldn't agree more. I've posted comments on that before; please let me know if anybody on the ia64 side has questions about it.

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center
#2 lore raw

Just quickly tried it out and my js20 blade boots without issue with this patch.

Quoted 17 lines · Hollis Blanchard
Quoted 2 lines · Isaku Yamahata

fix xencomm_copy_{from, to}_guest.
It should not call paddr_to_maddr() with invalid address.

Thanks Yamahata-san! I've asked Jerone (CCed) to give this a quick test.

Quoted 3 lines

Originally this issue was found in xen/ia64 xencomm code and in fact I didn't test this patch because currently ia64 xencomm forked from common code. They should be consolidated somehow.

I couldn't agree more. I've posted comments on that before; please let me know if anybody on the ia64 side has questions about it.

--
Hollis Blanchard
IBM Linux Technology Center

#3 lore raw
In reply to Isaku Yamahata

Keir, can you commit this patch to the tree. It has been tested and does not appear to cause any issues.

Quoted 7 lines · Isaku Yamahata

fix xencomm_copy_{from, to}_guest.
It should not call paddr_to_maddr() with invalid address.

Originally this issue was found in xen/ia64 xencomm code and in fact I didn't test this patch because currently ia64 xencomm forked from common code. They should be consolidated somehow.

Quoted 6 lines

--
yamahata
_______________________________________________
Xen-ppc-devel mailing list
[email protected]
http://lists.xensource.com/xen-ppc-devel

# HG changeset patch
# User [email protected]
# Date 1167966417 -32400
# Node ID 25cdcc5f21f8147371aed5fb8f56d93479df0ca8 # Parent 338ceb7b1f0993bf9735c0c1c5d21e39c381cf2f fix xencomm_copy_{from, to}_guest.
It should not call paddr_to_maddr() with invalid address.
PATCHNAME: fix_xencomm_copy_tofrom_guest

xen/common/xencomm.c +2 -2
diff -r 338ceb7b1f09 -r 25cdcc5f21f8 xen/common/xencomm.c
@@ -119,7 +119,7 @@ xencomm_copy_from_guest(void *to, const
         chunksz -= chunk_skip;
         skip -= chunk_skip;
 
-        if (skip == 0) {
+        if (skip == 0 && chunksz > 0) {
             unsigned long src_maddr;
             unsigned long dest = (unsigned long)to + to_pos;
             unsigned int bytes = min(chunksz, n - to_pos);
@@ -225,7 +225,7 @@ xencomm_copy_to_guest(void *to, const vo
         chunksz -= chunk_skip;
         skip -= chunk_skip;
 
-        if (skip == 0) {
+        if (skip == 0 && chunksz > 0) {
             unsigned long dest_maddr;
             unsigned long source = (unsigned long)from + from_pos;
             unsigned int bytes = min(chunksz, n - from_pos);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel