]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
ALSA: info: Fix racy addition/deletion of nodes
authorTakashi Iwai <tiwai@suse.de>
Tue, 16 Apr 2019 13:25:00 +0000 (15:25 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commitfec8af8c4f2f1028ac15d2e2da3115606d26e0fe
treed7cc440581a9616826e1d1d7033036d8accd3bbd
parent8baa461de09cee6f76ceefa5a85f913db1f1a12b
ALSA: info: Fix racy addition/deletion of nodes

BugLink: https://bugs.launchpad.net/bugs/1838349
commit 8c2f870890fd28e023b0fcf49dcee333f2c8bad7 upstream.

The ALSA proc helper manages the child nodes in a linked list, but its
addition and deletion is done without any lock.  This leads to a
corruption if they are operated concurrently.  Usually this isn't a
problem because the proc entries are added sequentially in the driver
probe procedure itself.  But the card registrations are done often
asynchronously, and the crash could be actually reproduced with
syzkaller.

This patch papers over it by protecting the link addition and deletion
with the parent's mutex.  There is "access" mutex that is used for the
file access, and this can be reused for this purpose as well.

Reported-by: syzbot+48df349490c36f9f54ab@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
sound/core/info.c