[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-upstream-unstable] audio: Don't free hw resources until after hw backend is stopped



commit 6569578197d93fcfeec4eb3e48c0659c18142dee
Author:     Peter Maydell <peter.maydell@xxxxxxxxxx>
AuthorDate: Tue Dec 16 16:58:05 2014 +0000
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Sun Feb 22 12:27:26 2015 -0600

    audio: Don't free hw resources until after hw backend is stopped
    
    When stopping an audio voice, call the audio backend's fini
    method before calling audio_pcm_hw_free_resources_ rather than
    afterwards. This allows backends which use helper threads (like
    pulseaudio) to terminate those threads before the conv_buf or
    mix_buf are freed and avoids race conditions where the helper
    may access a NULL pointer or freed memory.
    
    Cc: qemu-stable@xxxxxxxxxx
    Reviewed-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
    Signed-off-by: Peter Maydell <peter.maydell@xxxxxxxxxx>
    Message-id: 1418406239-9838-1-git-send-email-peter.maydell@xxxxxxxxxx
    (cherry picked from commit b28fb27b5edf77f6fd0ac550a156fb20f2218db3)
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 audio/audio_template.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/audio/audio_template.h b/audio/audio_template.h
index 8173188..584e536 100644
--- a/audio/audio_template.h
+++ b/audio/audio_template.h
@@ -191,9 +191,9 @@ static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp)
         audio_detach_capture (hw);
 #endif
         QLIST_REMOVE (hw, entries);
+        glue (hw->pcm_ops->fini_, TYPE) (hw);
         glue (s->nb_hw_voices_, TYPE) += 1;
         glue (audio_pcm_hw_free_resources_ ,TYPE) (hw);
-        glue (hw->pcm_ops->fini_, TYPE) (hw);
         g_free (hw);
         *hwp = NULL;
     }
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.