[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XEN] Fix read_console_ring() when passed a small buffer.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 92f071926e6edbd87e83cf117aaeb45cd5775c9b
# Parent  a936c9c3ea60cc0ed8aa712c00a19d377cc76d0f
[XEN] Fix read_console_ring() when passed a small buffer.
From: Akio Takebe <takebe_akio@xxxxxxxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/drivers/char/console.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff -r a936c9c3ea60 -r 92f071926e6e xen/drivers/char/console.c
--- a/xen/drivers/char/console.c        Mon Jun 12 09:57:23 2006 +0100
+++ b/xen/drivers/char/console.c        Mon Jun 12 10:05:55 2006 +0100
@@ -230,7 +230,7 @@ long read_console_ring(XEN_GUEST_HANDLE(
     sofar = 0;
 
     c = conringc;
-    while ( c != conringp )
+    while ( (c != conringp) && (sofar < max) )
     {
         idx = CONRING_IDX_MASK(c);
         len = conringp - c;
@@ -247,7 +247,10 @@ long read_console_ring(XEN_GUEST_HANDLE(
     if ( clear )
     {
         spin_lock_irqsave(&console_lock, flags);
-        conringc = conringp;
+        if ( (conringp - c) > CONRING_SIZE )
+            conringc = conringp - CONRING_SIZE;
+        else
+            conringc = c;
         spin_unlock_irqrestore(&console_lock, flags);
     }
 

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.