ia64/xen-unstable

changeset 16995:0672d5b11262

minios: Fix blkfront grant map leak

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 07 09:16:20 2008 +0000 (2008-02-07)
parents c9844192c965
children 3821e39cc1a0
files extras/mini-os/blkfront.c extras/mini-os/include/blkfront.h
line diff
     1.1 --- a/extras/mini-os/blkfront.c	Thu Feb 07 09:15:59 2008 +0000
     1.2 +++ b/extras/mini-os/blkfront.c	Thu Feb 07 09:16:20 2008 +0000
     1.3 @@ -258,7 +258,7 @@ void blkfront_aio(struct blkfront_aiocb 
     1.4  
     1.5      start = (uintptr_t)aiocbp->aio_buf & PAGE_MASK;
     1.6      end = ((uintptr_t)aiocbp->aio_buf + aiocbp->aio_nbytes + PAGE_SIZE - 1) & PAGE_MASK;
     1.7 -    n = (end - start) / PAGE_SIZE;
     1.8 +    aiocbp->n = n = (end - start) / PAGE_SIZE;
     1.9  
    1.10      /* qemu's IDE max multsect is 16 (8KB) and SCSI max DMA was set to 32KB,
    1.11       * so max 44KB can't happen */
    1.12 @@ -327,8 +327,8 @@ moretodo:
    1.13          case BLKIF_OP_WRITE:
    1.14          {
    1.15              struct blkfront_aiocb *aiocbp = (void*) (uintptr_t) rsp->id;
    1.16 -            int n = (aiocbp->aio_nbytes + PAGE_SIZE - 1) / PAGE_SIZE, j;
    1.17 -            for (j = 0; j < n; j++)
    1.18 +            int j;
    1.19 +            for (j = 0; j < aiocbp->n; j++)
    1.20                  gnttab_end_access(aiocbp->gref[j]);
    1.21  
    1.22              /* Nota: callback frees aiocbp itself */
     2.1 --- a/extras/mini-os/include/blkfront.h	Thu Feb 07 09:15:59 2008 +0000
     2.2 +++ b/extras/mini-os/include/blkfront.h	Thu Feb 07 09:16:20 2008 +0000
     2.3 @@ -11,6 +11,7 @@ struct blkfront_aiocb
     2.4      void *data;
     2.5  
     2.6      grant_ref_t gref[BLKIF_MAX_SEGMENTS_PER_REQUEST];
     2.7 +    int n;
     2.8  
     2.9      void (*aio_cb)(struct blkfront_aiocb *aiocb, int ret);
    2.10  };