This is a note to let you know that I've just added the patch titled ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() to the 6.0-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-rawmidi-drop-register_mutex-in-snd_rawmidi_free.patch and it can be found in the queue-6.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From a70aef7982b012e86dfd39fbb235e76a21ae778a Mon Sep 17 00:00:00 2001 From: Takashi Iwai <tiwai@xxxxxxx> Date: Tue, 11 Oct 2022 09:01:46 +0200 Subject: ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() From: Takashi Iwai <tiwai@xxxxxxx> commit a70aef7982b012e86dfd39fbb235e76a21ae778a upstream. The register_mutex taken around the dev_unregister callback call in snd_rawmidi_free() may potentially lead to a mutex deadlock, when OSS emulation and a hot unplug are involved. Since the mutex doesn't protect the actual race (as the registration itself is already protected by another means), let's drop it. Link: https://lore.kernel.org/r/CAB7eexJP7w1B0mVgDF0dQ+gWor7UdkiwPczmL7pn91xx8xpzOA@xxxxxxxxxxxxxx Cc: <stable@xxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20221011070147.7611-1-tiwai@xxxxxxx Signed-off-by: Takashi Iwai <tiwai@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- sound/core/rawmidi.c | 2 -- 1 file changed, 2 deletions(-) --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -1899,10 +1899,8 @@ static int snd_rawmidi_free(struct snd_r snd_info_free_entry(rmidi->proc_entry); rmidi->proc_entry = NULL; - mutex_lock(®ister_mutex); if (rmidi->ops && rmidi->ops->dev_unregister) rmidi->ops->dev_unregister(rmidi); - mutex_unlock(®ister_mutex); snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]); snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT]); Patches currently in stable-queue which might be from tiwai@xxxxxxx are queue-6.0/alsa-rawmidi-drop-register_mutex-in-snd_rawmidi_free.patch queue-6.0/alsa-oss-fix-potential-deadlock-at-unregistration.patch queue-6.0/alsa-usb-audio-fix-potential-memory-leaks.patch queue-6.0/alsa-hda-realtek-add-quirk-for-asus-gv601r-laptop.patch queue-6.0/alsa-hda-realtek-correct-pin-configs-for-asus-g533z.patch queue-6.0/alsa-hda-realtek-remove-alc289_fixup_dual_spk-for-dell-5530.patch queue-6.0/alsa-hda-realtek-add-intel-reference-ssid-to-support-headset-keys.patch queue-6.0/alsa-usb-audio-fix-null-dererence-at-error-path.patch