diff options
author | Thomas Bogendoerfer <tsbogend@alpha.franken.de> | 1998-09-20 21:16:37 +0000 |
---|---|---|
committer | Thomas Bogendoerfer <tsbogend@alpha.franken.de> | 1998-09-20 21:16:37 +0000 |
commit | 423736b0e0dc3e80d2d001ab4971daa4a2d42839 (patch) | |
tree | 2826ab09a18a27979cda912650756b6e8def7cda /arch/mips/jazz | |
parent | de8ebd301373b2aa3aae0bf2bae4e82b38623c9e (diff) |
fixed race in vdma_alloc(), when called from interrupt context
Diffstat (limited to 'arch/mips/jazz')
-rw-r--r-- | arch/mips/jazz/jazzdma.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/mips/jazz/jazzdma.c b/arch/mips/jazz/jazzdma.c index 988499c79..d249a296a 100644 --- a/arch/mips/jazz/jazzdma.c +++ b/arch/mips/jazz/jazzdma.c @@ -97,6 +97,7 @@ unsigned long vdma_alloc(unsigned long paddr, unsigned long size) unsigned int frame; unsigned long laddr; int i; + unsigned long flags; /* check arguments */ @@ -113,6 +114,7 @@ unsigned long vdma_alloc(unsigned long paddr, unsigned long size) return VDMA_ERROR; /* invalid physical address */ } + save_and_cli (flags); /* * Find free chunk */ @@ -123,8 +125,10 @@ unsigned long vdma_alloc(unsigned long paddr, unsigned long size) while (entry[first].owner != VDMA_PAGE_EMPTY && first < VDMA_PGTBL_ENTRIES) first++; - if (first+pages > VDMA_PGTBL_ENTRIES) /* nothing free */ + if (first+pages > VDMA_PGTBL_ENTRIES) { /* nothing free */ + restore_flags (flags); return VDMA_ERROR; + } last = first+1; while (entry[last].owner == VDMA_PAGE_EMPTY && last-first < pages) @@ -170,6 +174,7 @@ unsigned long vdma_alloc(unsigned long paddr, unsigned long size) printk("\n"); } + restore_flags(flags); return laddr; } |