Skip to content
  • Takashi Iwai's avatar
    ALSA: aloop: Fix access to not-yet-ready substream via cable · 88079d33
    Takashi Iwai authored
    commit 8e6b1a72
    
     upstream.
    
    In loopback_open() and loopback_close(), we assign and release the
    substream object to the corresponding cable in a racy way.  It's
    neither locked nor done in the right position.  The open callback
    assigns the substream before its preparation finishes, hence the other
    side of the cable may pick it up, which may lead to the invalid memory
    access.
    
    This patch addresses these: move the assignment to the end of the open
    callback, and wrap with cable->lock for avoiding concurrent accesses.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    88079d33