This is a note to let you know that I've just added the patch titled ALSA: mixart: Fix mutex deadlock to the 5.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: alsa-mixart-fix-mutex-deadlock.patch and it can be found in the queue-5.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From d21b96c8ed2aea7e6b7bf4735e1d2503cfbf4072 Mon Sep 17 00:00:00 2001 From: Takashi Iwai <tiwai@xxxxxxx> Date: Thu, 19 Nov 2020 13:14:40 +0100 Subject: ALSA: mixart: Fix mutex deadlock From: Takashi Iwai <tiwai@xxxxxxx> commit d21b96c8ed2aea7e6b7bf4735e1d2503cfbf4072 upstream. The code change for switching to non-atomic mode brought the unexpected mutex deadlock in get_msg(). It converted the spinlock with the existing mutex, but there were calls with the already holding the mutex. Since the only place that needs the extra lock is the code path from snd_mixart_send_msg(), remove the mutex lock in get_msg() and apply in the caller side for fixing the mutex deadlock. Fixes: 8d3a8b5cb57d ("ALSA: mixart: Use nonatomic PCM ops") Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20201119121440.18945-1-tiwai@xxxxxxx Signed-off-by: Takashi Iwai <tiwai@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- sound/pci/mixart/mixart_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/sound/pci/mixart/mixart_core.c +++ b/sound/pci/mixart/mixart_core.c @@ -70,7 +70,6 @@ static int get_msg(struct mixart_mgr *mg unsigned int i; #endif - mutex_lock(&mgr->msg_lock); err = 0; /* copy message descriptor from miXart to driver */ @@ -119,8 +118,6 @@ static int get_msg(struct mixart_mgr *mg writel_be(headptr, MIXART_MEM(mgr, MSG_OUTBOUND_FREE_HEAD)); _clean_exit: - mutex_unlock(&mgr->msg_lock); - return err; } @@ -258,7 +255,9 @@ int snd_mixart_send_msg(struct mixart_mg resp.data = resp_data; resp.size = max_resp_size; + mutex_lock(&mgr->msg_lock); err = get_msg(mgr, &resp, msg_frame); + mutex_unlock(&mgr->msg_lock); if( request->message_id != resp.message_id ) dev_err(&mgr->pci->dev, "RESPONSE ERROR!\n"); Patches currently in stable-queue which might be from tiwai@xxxxxxx are queue-5.9/alsa-usb-audio-add-delay-quirk-for-all-logitech-usb-devices.patch queue-5.9/alsa-hda-realtek-add-some-clove-ssid-in-the-alc293-alc1220.patch queue-5.9/alsa-hda-realtek-add-supported-for-lenovo-thinkpad-headset-button.patch queue-5.9/alsa-hda-realtek-add-supported-mute-led-for-hp.patch queue-5.9/alsa-ctl-fix-error-path-at-adding-user-defined-element-set.patch queue-5.9/alsa-mixart-fix-mutex-deadlock.patch queue-5.9/alsa-firewire-clean-up-a-locking-issue-in-copy_resp_to_buf.patch queue-5.9/alsa-hda-realtek-hp-headset-mic-can-t-detect-after-boot.patch