]> git.baikalelectronics.ru Git - 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)
committerTakashi Iwai <tiwai@suse.de>
Tue, 16 Apr 2019 13:49:48 +0000 (15:49 +0200)
commitecfdb043e3bef65a8df6906164e24b6a6c3122aa
treeb8f5661b420370763c62fa6c6b1afe31c80446e9
parent5df18dbc527ee8bf45b3b6f53ed1ccbe3f65e17c
ALSA: info: Fix racy addition/deletion of nodes

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>
sound/core/info.c