Skip to contentSkip to conversation

ALSA: soc: sti: a possible sleep-in-atomic-context bug in uni_player_ctl_iec958_put()

BUG Jia-Ju Bai 2 participants 2 messages Dec 18, 2019

lore
Share & tools
lore

Jia-Ju Bai

author
#0 lore raw

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

#1 lore raw

Hi Jia-Ju

Quoted 10 lines · Jia-Ju Bai

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

Quoted 5 lines

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

Quoted 5 lines

Best wishes,
Jia-Ju Bai