summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-03-17 14:00:06 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-23 14:55:24 -0700
commit21c1a226c542d4dd3bd7e0c69a3f9b6d34e37392 (patch)
tree8aa4a8f831bd7e4d4bebf0bf4ee563a78f60b919
parentcd0af9303b6953350278cbc650ad8173e8c0dc58 (diff)
downloadlinux-stable-21c1a226c542d4dd3bd7e0c69a3f9b6d34e37392.tar.gz
ALSA: Fix vunmap and free order in snd_free_sgbuf_pages()
commit 6af845e4eb36fb91b322aaf77ec1cab2220a48ad upstream. In snd_free_sgbuf_pags(), vunmap() is called after releasing the SG pages, and it causes errors on Xen as Xen manages the pages differently. Although no significant errors have been reported on the actual hardware, this order should be fixed other way round, first vunmap() then free pages. Cc: Jan Beulich <jbeulich@novell.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--sound/core/sgbuf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c
index d4564edd61d7..4e7ec2b49873 100644
--- a/sound/core/sgbuf.c
+++ b/sound/core/sgbuf.c
@@ -38,6 +38,10 @@ int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab)
if (! sgbuf)
return -EINVAL;
+ if (dmab->area)
+ vunmap(dmab->area);
+ dmab->area = NULL;
+
tmpb.dev.type = SNDRV_DMA_TYPE_DEV;
tmpb.dev.dev = sgbuf->dev;
for (i = 0; i < sgbuf->pages; i++) {
@@ -48,9 +52,6 @@ int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab)
tmpb.bytes = (sgbuf->table[i].addr & ~PAGE_MASK) << PAGE_SHIFT;
snd_dma_free_pages(&tmpb);
}
- if (dmab->area)
- vunmap(dmab->area);
- dmab->area = NULL;
kfree(sgbuf->table);
kfree(sgbuf->page_table);