linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] ALSA: soc: sti: a possible sleep-in-atomic-context bug in uni_player_ctl_iec958_put()
@ 2019-12-18 12:51 Jia-Ju Bai
  2019-12-18 13:24 ` Arnaud POULIQUEN
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2019-12-18 12:51 UTC (permalink / raw)
  To: arnaud.pouliquen, lgirdwood, broonie, perex, tiwai; +Cc: alsa-devel, LKML

The driver may sleep while holding a spinlock.
The function call path (from bottom to top) in Linux 4.19 is:

sound/soc/sti/uniperif_player.c, 229:
     mutex_lock in uni_player_set_channel_status
sound/soc/sti/uniperif_player.c, 608:
     uni_player_set_channel_status in uni_player_ctl_iec958_put
sound/soc/sti/uniperif_player.c, 603:
     _raw_spin_lock_irqsave in uni_player_ctl_iec958_put

mutex_lock() can sleep at runtime.

I am not sure how to properly fix this possible bug, so I only report it.

This bug is found by a static analysis tool STCheck written by myself.


Best wishes,
Jia-Ju Bai

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [BUG] ALSA: soc: sti: a possible sleep-in-atomic-context bug in uni_player_ctl_iec958_put()
  2019-12-18 12:51 [BUG] ALSA: soc: sti: a possible sleep-in-atomic-context bug in uni_player_ctl_iec958_put() Jia-Ju Bai
@ 2019-12-18 13:24 ` Arnaud POULIQUEN
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaud POULIQUEN @ 2019-12-18 13:24 UTC (permalink / raw)
  To: Jia-Ju Bai, lgirdwood, broonie, perex, tiwai; +Cc: alsa-devel, LKML

Hi Jia-Ju

On 12/18/19 1:51 PM, Jia-Ju Bai wrote:
> The driver may sleep while holding a spinlock.
> The function call path (from bottom to top) in Linux 4.19 is:
> 
> sound/soc/sti/uniperif_player.c, 229:
>      mutex_lock in uni_player_set_channel_status
> sound/soc/sti/uniperif_player.c, 608:
>      uni_player_set_channel_status in uni_player_ctl_iec958_put
> sound/soc/sti/uniperif_player.c, 603:
>      _raw_spin_lock_irqsave in uni_player_ctl_iec958_put
> 
> mutex_lock() can sleep at runtime.
> 
> I am not sure how to properly fix this possible bug, so I only report it.
> 
> This bug is found by a static analysis tool STCheck written by myself.
Thank you for pointing out the bug, I will test and send a fix.

Regards
Arnaud
> 
> 
> Best wishes,
> Jia-Ju Bai
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-18 13:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 12:51 [BUG] ALSA: soc: sti: a possible sleep-in-atomic-context bug in uni_player_ctl_iec958_put() Jia-Ju Bai
2019-12-18 13:24 ` Arnaud POULIQUEN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).