diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-02-07 09:16:20 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-02-07 09:16:20 +0000 |
commit | 9ea04252b60aeb6600e041a53100873b3f3a1a2e (patch) | |
tree | 9c79f4b137a7fbdee9ab9cfb2dfd0d75fe635fd3 /extras | |
parent | 563f5ebfcc413f153e9cb99d997ce2dabd920eb5 (diff) | |
download | xen-9ea04252b60aeb6600e041a53100873b3f3a1a2e.tar.gz xen-9ea04252b60aeb6600e041a53100873b3f3a1a2e.tar.bz2 xen-9ea04252b60aeb6600e041a53100873b3f3a1a2e.zip |
minios: Fix blkfront grant map leak
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Diffstat (limited to 'extras')
-rw-r--r-- | extras/mini-os/blkfront.c | 6 | ||||
-rw-r--r-- | extras/mini-os/include/blkfront.h | 1 |
2 files changed, 4 insertions, 3 deletions
diff --git a/extras/mini-os/blkfront.c b/extras/mini-os/blkfront.c index f07900580b..881efd3055 100644 --- a/extras/mini-os/blkfront.c +++ b/extras/mini-os/blkfront.c @@ -258,7 +258,7 @@ void blkfront_aio(struct blkfront_aiocb *aiocbp, int write) 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 --git a/extras/mini-os/include/blkfront.h b/extras/mini-os/include/blkfront.h index 92e658e899..034c793ff6 100644 --- a/extras/mini-os/include/blkfront.h +++ b/extras/mini-os/include/blkfront.h @@ -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); }; |