]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: atmel_ssc_dai: Remove wrong spinlock usage
authorGregory CLEMENT <gregory.clement@bootlin.com>
Wed, 18 Sep 2019 10:03:44 +0000 (12:03 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 18 Sep 2019 10:12:24 +0000 (11:12 +0100)
commitc574c7834128a5d05da9b519212bac508b13d867
tree5ad1e15f8f6188b90de37bb6f0ab025ad07b106b
parentafa85fa6dd0ef6870c1f4cf64dad0e3375203d1f
ASoC: atmel_ssc_dai: Remove wrong spinlock usage

A potential bug was reported in the email "[BUG] atmel_ssc_dai: a
possible sleep-in-atomic bug in atmel_ssc_shutdown"[1]

Indeed in the function atmel_ssc_shutdown() free_irq() was called in a
critical section protected by spinlock.

However this spinlock is only used in atmel_ssc_shutdown() and
atmel_ssc_startup() functions. After further analysis, it occurred that
the call to these function are already protected by mutex used on the
calling functions.

Then we can remove the spinlock which will fix this bug as a side
effect. Thanks to this patch the following message disappears:

"BUG: sleeping function called from invalid context at
kernel/locking/mutex.c:909"

[1]: https://www.spinics.net/lists/alsa-devel/msg71286.html

Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Link: https://lore.kernel.org/r/20190918100344.23629-1-gregory.clement@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/atmel/atmel_ssc_dai.c
sound/soc/atmel/atmel_ssc_dai.h