diff options
author | Jaroslav Kysela <perex@perex.cz> | 2008-06-17 16:20:13 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-06-17 16:20:13 +0200 |
commit | 9f515b6898d0f2c1b9eb34ae9986794045f34e2b (patch) | |
tree | 85bb527513fbbcc62d8d3fa5d6762f906df3787f /sound/pci/emu10k1 | |
parent | 6719292af5513da52aa876d0e7ac4367a0851845 (diff) | |
download | op-kernel-dev-9f515b6898d0f2c1b9eb34ae9986794045f34e2b.zip op-kernel-dev-9f515b6898d0f2c1b9eb34ae9986794045f34e2b.tar.gz |
ALSA: emu10k1 - fix possible memory leak in memory allocation routines
The leak was introduced in "[ALSA] emu10k1 - simplify page allocation
for synth" commit.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/emu10k1')
-rw-r--r-- | sound/pci/emu10k1/memory.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c index 42943b4..759e29f 100644 --- a/sound/pci/emu10k1/memory.c +++ b/sound/pci/emu10k1/memory.c @@ -464,11 +464,17 @@ static int synth_alloc_pages(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk /* first try to allocate from <4GB zone */ struct page *p = alloc_page(GFP_KERNEL | GFP_DMA32 | __GFP_NOWARN); - if (!p || (page_to_pfn(p) & ~(emu->dma_mask >> PAGE_SHIFT))) + if (!p || (page_to_pfn(p) & ~(emu->dma_mask >> PAGE_SHIFT))) { /* try to allocate from <16MB zone */ - p = alloc_page(GFP_ATOMIC | GFP_DMA | + struct page *p1 = + alloc_page(GFP_ATOMIC | GFP_DMA | __GFP_NORETRY | /* no OOM-killer */ __GFP_NOWARN); + /* free page outside dma_mask range */ + if (p) + free_page((unsigned long)page_address(p)); + p = p1; + } if (!p) { __synth_free_pages(emu, first_page, page - 1); return -ENOMEM; |