ALSA: ctl: Workaround for lockdep warning wrt card->ctl_files_rwlock
authorTakashi Iwai <tiwai@suse.de>
Tue, 22 Sep 2020 08:49:53 +0000 (10:49 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 22 Sep 2020 09:07:10 +0000 (11:07 +0200)
commit6564d0ad67efb2d977e130e7448505ee538af016
tree7c8bc723dd5c3924053ad21f505f333b00f32a59
parent534ad9afb19b5ac810a5e1c638f371e81e0c1ed6
ALSA: ctl: Workaround for lockdep warning wrt card->ctl_files_rwlock

The recent change in lockdep for read lock caused the deadlock
warnings in ALSA control code which uses the read_lock() for
notification and else while write_lock_irqsave() is used for adding
and removing the list entry.  Although a deadlock would practically
never hit in a real usage (the addition and the deletion can't happen
with the notification), it's better to fix the read_lock() usage in a
semantically correct way.

This patch replaces the read_lock() calls with read_lock_irqsave()
version for avoiding a reported deadlock.  The notification code path
takes the irq disablement in anyway, and other code paths are very
short execution, hence there shouldn't be any big performance hit by
this change.

Fixes: e918188611f0 ("locking: More accurate annotations for read_lock()")
Reported-by: syzbot+561a74f84100162990b2@syzkaller.appspotmail.com
Link: https://lore.kernel.org/r/20200922084953.29018-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/control.c