]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: oss: Fix potential deadlock at unregistration
authorTakashi Iwai <tiwai@suse.de>
Tue, 11 Oct 2022 07:01:47 +0000 (09:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 11:22:10 +0000 (13:22 +0200)
commit5e518603689328e792194b88427540a55ffaf7ee
tree8fab044e1cd9f10d0d995bee092ee4f8079859b1
parent03e5da09011189e461528bcc151855f834423917
ALSA: oss: Fix potential deadlock at unregistration

commit 692dca786b4d1e7b0424a48378e463ddf67780f5 upstream.

We took sound_oss_mutex around the calls of unregister_sound_special()
at unregistering OSS devices.  This may, however, lead to a deadlock,
because we manage the card release via the card's device object, and
the release may happen at unregister_sound_special() call -- which
will take sound_oss_mutex again in turn.

Although the deadlock might be fixed by relaxing the rawmidi mutex in
the previous commit, it's safer to move unregister_sound_special()
calls themselves out of the sound_oss_mutex, too.  The call is
race-safe as the function has a spinlock protection by itself.

Link: https://lore.kernel.org/r/CAB7eexJP7w1B0mVgDF0dQ+gWor7UdkiwPczmL7pn91xx8xpzOA@mail.gmail.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20221011070147.7611-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/core/sound_oss.c