]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ALSA: seq: Fix lockdep warnings due to double mutex locks
authorTakashi Iwai <tiwai@suse.de>
Wed, 3 Feb 2016 07:32:44 +0000 (08:32 +0100)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 26 May 2016 22:44:42 +0000 (15:44 -0700)
commitc6c866038186266a492f4278f6bfdec29fe0ac49
tree35f6b9705434ff52986cb21b4790dbb1b4f859ed
parent608214092b70a202362ad676616086130f429213
ALSA: seq: Fix lockdep warnings due to double mutex locks

Orabug: 23330807

[ Upstream commit 7f0973e973cd74aa40747c9d38844560cd184ee8 ]

The port subscription code uses double mutex locks for source and
destination ports, and this may become racy once when wrongly set up.
It leads to lockdep warning splat, typically triggered by fuzzer like
syzkaller, although the actual deadlock hasn't been seen, so far.

This patch simplifies the handling by reducing to two single locks, so
that no lockdep warning will be trigger any longer.

By splitting to two actions, a still-in-progress element shall be
added in one list while handling another.  For ignoring this element,
a new check is added in deliver_to_subscribers().

Along with it, the code to add/remove the subscribers list element was
cleaned up and refactored.

BugLink: http://lkml.kernel.org/r/CACT4Y+aKQXV7xkBW9hpQbzaDO7LrUvohxWh-UwMxXjDy-yBD=A@mail.gmail.com
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
(cherry picked from commit 44660dacb478f79d7fbc7cec0ef342414b563b6a)

Signed-off-by: Dan Duval <dan.duval@oracle.com>
sound/core/seq/seq_clientmgr.c
sound/core/seq/seq_ports.c