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

[Xen-changelog] [xen-unstable] minios: Fix blkfront grant map leak



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1202375780 0
# Node ID 0672d5b11262be541f12e74e604f10a04d319cfa
# Parent  c9844192c9651aab174d365648acc035897c193b
minios: Fix blkfront grant map leak

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
---
 extras/mini-os/blkfront.c         |    6 +++---
 extras/mini-os/include/blkfront.h |    1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff -r c9844192c965 -r 0672d5b11262 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c Thu Feb 07 09:15:59 2008 +0000
+++ b/extras/mini-os/blkfront.c Thu Feb 07 09:16:20 2008 +0000
@@ -258,7 +258,7 @@ void blkfront_aio(struct blkfront_aiocb 
 
     start = (uintptr_t)aiocbp->aio_buf & PAGE_MASK;
     end = ((uintptr_t)aiocbp->aio_buf + aiocbp->aio_nbytes + PAGE_SIZE - 1) & 
PAGE_MASK;
-    n = (end - start) / PAGE_SIZE;
+    aiocbp->n = n = (end - start) / PAGE_SIZE;
 
     /* qemu's IDE max multsect is 16 (8KB) and SCSI max DMA was set to 32KB,
      * so max 44KB can't happen */
@@ -327,8 +327,8 @@ moretodo:
         case BLKIF_OP_WRITE:
         {
             struct blkfront_aiocb *aiocbp = (void*) (uintptr_t) rsp->id;
-            int n = (aiocbp->aio_nbytes + PAGE_SIZE - 1) / PAGE_SIZE, j;
-            for (j = 0; j < n; j++)
+            int j;
+            for (j = 0; j < aiocbp->n; j++)
                 gnttab_end_access(aiocbp->gref[j]);
 
             /* Nota: callback frees aiocbp itself */
diff -r c9844192c965 -r 0672d5b11262 extras/mini-os/include/blkfront.h
--- a/extras/mini-os/include/blkfront.h Thu Feb 07 09:15:59 2008 +0000
+++ b/extras/mini-os/include/blkfront.h Thu Feb 07 09:16:20 2008 +0000
@@ -11,6 +11,7 @@ struct blkfront_aiocb
     void *data;
 
     grant_ref_t gref[BLKIF_MAX_SEGMENTS_PER_REQUEST];
+    int n;
 
     void (*aio_cb)(struct blkfront_aiocb *aiocb, int ret);
 };

_______________________________________________
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®.